Files
H100PowerManger/test/scripts/back/testGui.py
T
2025-01-21 19:34:23 +08:00

45 lines
1.1 KiB
Python

import socket
import struct
import tkinter as tk
import threading
from udpmsg import *
from datetime import datetime
from tkinter import font
from disSys import *
from guiEle import ElementDisplayApp
from until import *
from guiInput import InputGUI
# 创建UDP套接字
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address = ('localhost', 5001)
sock.bind(server_address)
# 创建主窗口
root = tk.Tk()
root.title("能源管理系统调试")
disSysWin = disSys(root)
disSysWin.grid(row=0, column=0, sticky='ne')
# 创建一个文本框用于显示消息
custom_font = font.Font(family="Arial", size=12, weight="normal")
text_box = tk.Text(root, height=10, width=50, font=custom_font)
text_box.grid(row=6, column=0, sticky='ne')
# 创建并启动接收和发送消息的线程
# thread = threading.Thread(target=receive_messages, args=(sock, text_box,eleplay))
# thread.daemon = True
# thread.start()
# thread2 = threading.Thread(target=send_messages, args=(sock, eleplay))
# thread2.daemon = True
# thread2.start()
# 运行主循环
root.mainloop()
# 关闭套接字
sock.close()