我不知道为什么这给我一个属性错误。我希望我的blah()
功能可以洗牌。我正在从random
调用内置函数shuffle()
。Python Tkinter:AttributeError:按钮实例没有__call__方法
错误:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1489, in __call__
return self.func(*args)
File "gui1.py", line 105, in blah
shuffle(cards)
AttributeError: Button instance has no __call__ method
下面的代码片段:
def blah():
global card_count
global path
shuffle(cards)
card_count = 0
path = generate_paths(cards)
print "Cards Shuffled"
shuffle = Button(frame_buttons, text = "SHUFFLE",height = 2, width = 10,command =blah)
shuffle.grid(row = 2 , padx = 40, pady = 40)
您可以添加“Button”被定义和/或导入的代码部分吗? – 2015-04-05 07:52:32
'Button'是'tkinter'中的一个类。 – TigerhawkT3 2015-04-05 18:14:34