from time import strftime
import ttkbootstrap as ttk
top = ttk.Window(themename='vapor')
top.title("数字时钟")
def clock():
text = strftime(' %H:%M:%S %p ')
lbl.config(text=text)
lbl.after(1000, clock) # 1秒刷新
lbl = ttk.Label(top, font=('digital-7', 80, 'bold'), foreground='red')
lbl.pack(anchor='center')
clock()
top.mainloop()
Python 十多行代码实现数字时钟
最新推荐文章于 2024-05-22 10:44:47 发布