import tkinter as tk
from tkinter import ttk

# 创建主窗口
root = tk.Tk()
root.title("📅 我的课程表")
root.geometry("900x550")  # 窗口大小
root.resizable(False, False)  # 固定窗口大小

# 样式设置
style = ttk.Style()
style.configure("Treeview.Heading", font=("微软雅黑", 12, "bold"))  # 表头字体
style.configure("Treeview", font=("微软雅黑", 11), rowheight=40)  # 表格字体

# 创建表格
columns = ["节次", "周一", "周二", "周三", "周四", "周五", "周六", "周日"]
tree = ttk.Treeview(root, columns=columns, show="headings")

# 设置表头和列宽
for col in columns:
    tree.heading(col, text=col)
    tree.column(col, width=110, anchor="center")

# 课程数据（可以自己修改！）
schedule_data = [
    ["1-2节", "Python编程", "英语", "高数", " ", "毛概", " ", " "],
    ["3-4节", "Python编程", "高数", "英语", " ", "体育", " ", " "],
    ["午休 ————", "——————", "——————", "——————", "——————", "——————", "——————", "——————"],
    ["5-6节", "数据结构", " ", "思政", "物理", " ", "兼职", "睡觉"],
    ["7-8节", "数据结构", "C语言", " ", "物理", " ", "兼职", "睡觉"],
    ["晚  上", "自习", "自习", "社团", "自由", "自由", "逛街", "休息"],
]

# 插入数据到表格
for data in schedule_data:
    tree.insert("", "end", values=data)

# 给表格加颜色（午休行高亮）
tree.tag_configure("rest", background="#f0f0f0")
tree.item(tree.get_children()[2], tags=("rest",))

# 布局
tree.pack(pady=20, padx=20, fill=tk.BOTH, expand=True)

# 运行窗口
root.mainloop()