0
我正在使用Python 2.7和Tkinter。我正在尝试使按钮在点击时更改其自己的文本。该代码似乎是正确的,但我一直遇到这样的错误:如何在Python中为我的函数提供“参数”?
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1413, in __call__
return self.func(*args)
TypeError: doStuff takes exactly 1 argument (0 given)
这里是我的代码:
def doStuff(event):
button01.configure(command=doStuff2)
button01.configure(text="Click me again!")
button01 = Button(root, text="Click me", command=doStuff)
button01.grid(row=8, column=6)
我在哪里搞砸了,我如何通过所需要的参数doStuff()
?