[Tkinter-discuss] bind between event and callback

守株待兔 1248283536 at qq.com
Wed Aug 17 04:41:52 CEST 2011


code1
from Tkinter import *
root = Tk()
def callback(event):
    print "i am here"
    
frame = Frame(root, width=100, height=100)
frame.bind("<Return>", callback)
frame.pack()
root.mainloop()

when  i press  "enter",there is no output  "i am here"
code2
from Tkinter import *
root = Tk()
def callback(event):
    print "i am here"
    
frame = Frame(root, width=100, height=100)
frame.bind("<Key>", callback)
frame.pack()
root.mainloop()

 when  i press  any key ,there is no output  "i am here"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110817/f2d3cd1b/attachment.html>


More information about the Tkinter-discuss mailing list