我想用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