我想调用另一个类中的方法,并在Python中单击按钮时对父类进行更改。解释一下,在Tkinter可视化编程中,我单击按钮来更改主窗口,我不能用另一个类方法更改主窗口中的属性。在
我收到下面的错误消息。在
Exception in Tkinter callback Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/_ init _.py", line 1553, in _ call _
return self.func(*args) TypeError: buton_goster() missing 1 required positional argument: 'event'
class Butonol(object): #Button class
def __init__(self):
...
def buton_goster(self, event ): # Properties kisminda ozellik gosterir
Test.countshow = Test.countshow + 1;
if(Test.countshow >1):
Test.props0.pack_forget()
Test.props.pack_forget()
...
这是测试课
^{pr2}$
错误是正确的, 绑定时,不传递事件,只需添加函数指针即可。在
如果buton goster不需要“event”,则应该删除它,或者在调用函数时提供event作为输入。在
相关问题 更多 >
编程相关推荐