import tkinter as tk
import time

def update_time():
    # 获取当前时间，格式为 小时:分钟:秒
    current_time = time.strftime("%H:%M:%S")
    # 更新标签内容
    label.config(text=current_time)
    # 每隔 1000 毫秒（1秒）递归调用自己
    label.after(1000, update_time)

# 创建窗口
root = tk.Tk()
root.title("Python 电子时钟")

# 设置字体和颜色
label = tk.Label(root, font=("Arial", 80), bg="black", fg="cyan")
label.pack(fill="both", expand=True)

# 启动时间更新
update_time()

# 运行窗口
root.mainloop()