我正在为我的测验应用程序创建一个定时器,我决定先在一个单独的程序中进行试验。 然而,当我运行下面的代码并按下 "开始计时器 "按钮时,该应用程序根本停止响应 我被迫通过任务管理器关闭它
from tkinter import *
import time
root=Tk()
root.geometry('{}x{}'.format(300,200))
lb=Label(root,text='')
lb.pack()
def func(h,m,s):
lb.config(text=str(h)+':'+str(m)+':'+str(s))
time.sleep(1)
func(h,m,s)
if s==59:
bt=Button(root,text='start timer',command=lambda:func(0,0,0))
bt.pack()
root.mainloop()