You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.2 KiB
47 lines
1.2 KiB
import tkinter as tk
|
|
import subprocess
|
|
import threading
|
|
|
|
# 使用线程来运行 NEW.py和 NEV.py。
|
|
def run_new():
|
|
try:
|
|
threading.Thread(target=lambda: subprocess.run(["python", "NEW.py"])).start()
|
|
except FileNotFoundError:
|
|
print("找不到NEW.py文件")
|
|
|
|
|
|
def run_nev():
|
|
try:
|
|
threading.Thread(target=lambda: subprocess.run(["python", "NEV.py"])).start()
|
|
except FileNotFoundError:
|
|
print("找不到NEV.py文件")
|
|
|
|
|
|
# 创建主窗口
|
|
root = tk.Tk()
|
|
root.title("文件安全传输工具")
|
|
# 设置窗口大小
|
|
root.geometry("300x150")
|
|
|
|
# 创建标签
|
|
label = tk.Label(root, text="请选择您的身份:")
|
|
label.pack(pady=10)
|
|
|
|
# 创建按钮框架,用于在同一行放置按钮
|
|
button_frame = tk.Frame(root)
|
|
button_frame.pack()
|
|
|
|
# 创建发送方按钮
|
|
sender_button = tk.Button(button_frame, text="发送方", command=run_new)
|
|
sender_button.pack(side=tk.LEFT, padx=10)
|
|
|
|
# 创建接收方按钮
|
|
receiver_button = tk.Button(button_frame, text="接收方", command=run_nev)
|
|
receiver_button.pack(side=tk.LEFT, padx=10)
|
|
|
|
# 创建关闭按钮
|
|
confirm_button = tk.Button(button_frame, text="关闭", command=root.destroy)
|
|
confirm_button.pack(side=tk.LEFT, padx=10)
|
|
|
|
# 运行主循环
|
|
root.mainloop() |