I've been running 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 use python 2.7 on window 7)
If I use
w.bind("<Button-1>", callback)
Things work fine.
So, this really puzzles me.
Please anyone tell me why this's happening, thanks in advance.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…