jack пре 8 месеци
родитељ
комит
c8ea960b60
1 измењених фајлова са 25 додато и 6 уклоњено
  1. 25 6
      main.py

+ 25 - 6
main.py

@@ -2,6 +2,8 @@
 from urllib.parse import quote
 import subprocess
 import httpx
+import tkinter as tk
+
 
 nodes = [
     ["192.168.31.201", ['58001', '58002', '58003', '58004', '58005', '58006', '58007', '58008', '58009',
@@ -12,6 +14,7 @@ nodes = [
 ]
 
 selected_nodes = nodes[0]
+output_messages = []  # 用于存储输出信息
 
 
 def patch_config(url_and_port):
@@ -88,7 +91,6 @@ def check_now_proxy(url_and_port):
 
         return now_proxy
 
-
     except httpx.RequestError as e:
         print(f"Request failed: {e}")
         return False
@@ -108,13 +110,30 @@ def run():
         # 检测当前代理节点的延迟
         check_result = check_proxy(url_and_port, now_proxy)
 
-        message = f"{url_and_port} --- {now_proxy} --- {check_result}\n{'*' * 88}\n"
+        message = f"{url_and_port} --- {now_proxy} --- {check_result}\n{'*' * 88}\n\n"
         print(message)
+        output_messages.append(message)  # 将输出信息添加到列表中
+
+
+def display_output():
+    run()  # 执行主逻辑
+    output_text.delete(1.0, tk.END)  # 清空文本框
+    for message in output_messages:  # 将所有输出信息显示到文本框中
+        output_text.insert(tk.END, message)
+
 
+# 创建主窗口
+root = tk.Tk()
+root.title("Proxy Checker")
+root.geometry("800x900")
 
-def main():
-    run()
+# 创建按钮
+check_button = tk.Button(root, text="Check Node", command=display_output)
+check_button.pack(pady=10)
 
+# 创建文本框(不带滚动条)
+output_text = tk.Text(root, width=100, height=60)
+output_text.pack(pady=10)
 
-if __name__ == "__main__":
-    main()
+# 启动主循环
+root.mainloop()