【发布时间】:2017-10-07 15:36:16
【问题描述】:
我想用 tkinter 写一个简单的计时器。 我有一个开始按钮:
start_button = tkinter.Button(root, bg="white", text="Start", command=start_button_clicked)
以及在点击时运行的命令
def start_button_clicked():
start_button.config(text='Started', state='disabled')
tm = timer.Timer()
tm.count_time(1)
我希望它会发生
- 更改按钮文本和状态
- 创建新计时器并运行倒计时
但实际上按钮参数只有在定时器用完后才会改变。 为什么会这样?如何在点击后立即更改 bu 按钮?
【问题讨论】: