1 from tkinter import * 2 counter = 30 3 def run_counter(digit): 4 def counting(): 5 global counter 6 counter -= 1 7 digit.config(text=str(counter)) 8 digit.after(1000,counting) 9 counting() 10 root = Tk() 11 root.title("30秒倒计时") 12 digit=Label(root,bg="yellow",fg="blue",height=3,width=10,font="Helvetic 20 bold") 13 digit.pack() 14 run_counter(digit) 15 16 root.mainloop()
原文地址:https://www.cnblogs.com/zmzzm/p/11969770.html
时间: 2024-10-26 07:18:48