Mega Code Archive

 
Categories / Python / Event
 

Button single click and double click

from Tkinter import * def hello(event):     print 'Press twice to exit'               def quit(event):                                  print 'Hi...'             import sys; sys.exit()  widget = Button(None, text='Hello event world') widget.pack() widget.bind('<Button-1>', hello)              widget.bind('<Double-1>', quit)               widget.mainloop()