电子时钟

import tkinter as tk
import tkinter.ttk as ttk
from time import strftime

window = tk.Tk()
window.title('电子时钟')
window.minsize(400, 200)
window.resizable(True, True)

def get_time():
     local_time = strftime('%H:%M:%S %p')    
     LB_1.config(text=(local_time))
     window.after(1000, get_time)
     return

LB_1 = ttk.Label(window, font=('微软雅黑', 20, 'bold'), anchor=tk.NW, background='#008CBA', foreground='white')
LB_1.pack(fill=tk.BOTH, expand=True)
get_time() 

window.mainloop()

  

posted @ 2023-07-15 17:03  疯陈演义  阅读(16)  评论(0编辑  收藏  举报