我的程序:
#!/usr/bin/python
from Tkinter import *
class App:
def __init__(self,master):
frame = Frame(master,width = 100,height = 100)
frame.bind('<Return>',self.ret)
frame.pack()
def ret(self):
print "You pressed enter"
root = Tk()
app = App(root)
root.mainloop()
它打开了窗口,但是当我按回车键或输入时,它什么也没做。