-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.py
More file actions
55 lines (44 loc) · 1.56 KB
/
Copy pathmenu.py
File metadata and controls
55 lines (44 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import tkinter as tk
import subprocess
import sys
import os
def run_script(script_name):
"""运行指定的 shell 脚本"""
subprocess.Popen(['bash', './' + script_name])
def on_launch():
run_script('run.sh')
def on_settings():
run_script('option.sh')
def on_extension_manager():
run_script('ExtensionViewer.sh')
def on_lupgrade():
run_script("LUpgrade.sh")
def on_exit():
root.destroy()
sys.exit()
# 创建主窗口
root = tk.Tk()
root.title("启动台")
root.geometry("300x300")
root.resizable(False, False)
# 配色
button_bg = "#ffe038"
button_fg = "black"
button_font = ("Arial", 12, "bold")
# 创建按钮
btn_launch = tk.Button(root, text="启动", command=on_launch,
bg=button_bg, fg=button_fg, font=button_font, width=20, height=1)
btn_settings = tk.Button(root, text="设置", command=on_settings,
bg=button_bg, fg=button_fg, font=button_font, width=20, height=1)
btn_ext_mgr = tk.Button(root, text="扩展管理器", command=on_extension_manager,
bg=button_bg, fg=button_fg, font=button_font, width=20, height=1)
btn_exit = tk.Button(root, text="关闭", command=on_exit,
bg=button_bg, fg=button_fg, font=button_font, width=20, height=1)
# 布局按钮(垂直居中)
btn_launch.pack(pady=10)
btn_settings.pack(pady=10)
btn_ext_mgr.pack(pady=10)
tk.Button(root, text="升级助手", command=on_lupgrade, bg=button_bg, fg=button_fg, font=button_font, width=20, height=1).pack(pady=10)
btn_exit.pack(pady=10)
# 启动 GUI 主循环
root.mainloop()