vendredi 8 mai 2015

python bind code not working as expected

Why does the following code not produce the expected result?:

from Tkinter import *
root = Tk()
def key(event):
    frame.focus_set()
    print "pressed", repr(event.char
frame = Frame(root, width=100, height=100)
frame.bind("<Key>", key)
frame.pack()
root.mainloop()

Aucun commentaire:

Enregistrer un commentaire