【发布时间】:2015-12-08 15:52:01
【问题描述】:
class Clicked():
dogame=True
def __init__(self):
None
def change(self):
self.dogame=False
currentgame=Clicked()
root = Tk()
def quitt():
root.destroy()
currentgame.change()
qbutton = Button(base, text = "Quit", command = quitt(), foreground = "Red", **kwargs)
qbutton.pack(side = BOTTOM)
这是我正在尝试编写的游戏代码的一部分。我想知道为什么当我单击 qbutton 时它不会破坏窗口。我需要它,这样当我按下按钮时,我也会更改 dogame 的值,所以我不能简单地设置 command=root.destroy
【问题讨论】: