我想用tkinter编写一个简单的定时器。 我有一个启动按钮:python3 + 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按钮?
它是我自己的自定义计时器。所以这并不奇怪,它不起作用。你的建议帮了很大忙,谢谢! – dariaamir