【发布时间】:2015-04-05 05:44:51
【问题描述】:
我不知道为什么这会给我一个属性错误。我想要我的blah() 函数来洗牌。我正在从random 调用内置函数shuffle()。
错误:
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
这里是sn-p的代码:
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的代码部分? -
Button是tkinter中的一个类。