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

 30秒倒计时 Python

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。