40 lines
963 B
Python
40 lines
963 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
测试GUI导入 - 简化版
|
|
"""
|
|
|
|
import sys
|
|
import traceback
|
|
|
|
try:
|
|
print("开始导入...", flush=True)
|
|
|
|
print("1. 导入customtkinter...", flush=True)
|
|
import customtkinter as ctk
|
|
print(" 成功!", flush=True)
|
|
|
|
print("2. 设置主题...", flush=True)
|
|
ctk.set_appearance_mode("dark")
|
|
ctk.set_default_color_theme("blue")
|
|
print(" 成功!", flush=True)
|
|
|
|
print("3. 创建主窗口...", flush=True)
|
|
app = ctk.CTk()
|
|
app.title("测试窗口")
|
|
app.geometry("400x300")
|
|
print(" 成功!", flush=True)
|
|
|
|
print("4. 添加标签...", flush=True)
|
|
label = ctk.CTkLabel(app, text="测试标签")
|
|
label.pack(pady=20)
|
|
print(" 成功!", flush=True)
|
|
|
|
print("5. 启动主循环...", flush=True)
|
|
app.mainloop()
|
|
print(" 完成!", flush=True)
|
|
|
|
except Exception as e:
|
|
print(f"\n错误: {e}", flush=True)
|
|
traceback.print_exc()
|
|
sys.exit(1)
|