有没有办法做到这一点?
WoodInt = GatherWood(WoodInt)
在tkinter按钮上?
BWood = tk.Button(Top, text ="Gather Wood", command = GatherWood)
我想要做的是,每次我按下按钮,WoodInt
就会增加20。
发布于 2018-07-16 13:40:40
然而,目前还不清楚GatherWood
是否会这样做,一种方法是将您按钮链接到一个将WoodInt
递增20的命令:
def increment_woodint_by_20():
global WoodInt
Woodint += 20
WoodInt = GatherWood(WoodInt)
BWood = tk.Button(Top, text ="Gather Wood", command=increment_woodint_by_20)
...
https://stackoverflow.com/questions/51354280
复制相似问题