I ran a small script like this
from Tkinter import *
root = Tk()
def callback(event):
print "callback"
w = Canvas(root, width=300, height=300)
w.bind("<Key>", callback)
w.pack()
root.mainloop()
However, the keyboard event is not handled in my situation (I am using python 2.7 in window 7)
If i use
w.bind("<Button-1>", callback)
Everything is working fine.
So that really puzzles me. Please tell me why this is happening, thanks in advance.
source
share