Double left clicked : Mouse « Tkinker « Python Tutorial






Double left clicked
from Tkinter import *
     
def showPosEvent(event):
    print 'Widget=%s X=%s Y=%s' % (event.widget, event.x, event.y)
     
def showAllEvent(event):
    print event
    for attr in dir(event): 
        print attr, '=>', getattr(event, attr) 
     
     
def onDoubleLeftClick(event):
    print 'Got double left mouse click',
    showPosEvent(event)
    tkroot.quit()
     
tkroot = Tk()
labelfont = ('courier', 20, 'bold')                
widget = Label(tkroot, text='Hello bind world')
widget.config(bg='red', font=labelfont)            
widget.config(height=5, width=20)                  
widget.pack(expand=YES, fill=BOTH)

widget.bind('<Double-1>',  onDoubleLeftClick)      

widget.focus()                                     
tkroot.title('Click Me')
tkroot.mainloop()








18.22.Mouse
18.22.1.Left button clickedLeft button clicked
18.22.2.Right button clickedRight button clicked
18.22.3.Drag with Left buttonDrag with Left button
18.22.4.Middle button clickedMiddle button clicked
18.22.5.Double left clickedDouble left clicked
18.22.6.Mouse events example.Mouse events example.
18.22.7.Mouse button differentiation.Mouse button differentiation.
18.22.8.Bind mouse button with action functionBind mouse button with action function