I have this code:
#!/usr/bin/python3
from Tkinter import *
def keypress(key):
print key, "pressed"
if __name__ == '__main__':
root = Tk()
root.bind('<Return>', keypress(key="enter"))
root.bind('a', keypress(key="a"))
root.mainloop()
我注意到该函数在程序启动时立即被调用;如何使其在不立即调用的情况下将参数传递给keypress函数?