Mega Code Archive

 
Categories / Python / Event
 

Action Key

from Tkinter import * def onArrowKey(event):      print 'Got arrow key press' 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('<Down>',        onArrowKey)            widget.focus()                                     tkroot.title('Click Me') tkroot.mainloop()