30秒倒计时

 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()

猜你喜欢

转载自www.cnblogs.com/zmzzm/p/11969770.html