import tkinter as tk
from win32.win32api import GetSystemMetrics
import time
def main():
def update_clock():
current_time = time.strftime("%H:%M:%S")
clock_label.config(text=current_time)
root.after(1000, update_clock) # 每秒更新一次
def exit_program(event):
root.destroy()
root = tk.Tk()
root.attributes("-fullscreen", True) # 全屏显示
w=GetSystemMetrics(0)
h=GetSystemMetrics(1)
root.geometry(f'{w}x{h}')
clock_label = tk.Label(root, font=("微软雅黑", 250), fg="white", bg="black", width=w,height=h)
clock_label.pack(expand=True)
update_clock()
root.bind("<Key>", exit_program)
root.mainloop()
main()
python-实现电子时钟,仿造fliqlo
最新推荐文章于 2024-08-10 23:55:00 发布