有没有办法做到这一点
WoodInt = GatherWood(WoodInt)
在tkinter按钮上?
BWood = tk.Button(Top, text ="Gather Wood", command = GatherWood)
我要做的是每次按下按钮时,WoodInt
会增加20。
答案 0 :(得分:0)
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)
...