# -*- coding:utf-8 -*- import sys from pathlib import Path from PySide6.QtUiTools import loadUiType from PySide6 import QtWidgets,QtCore # 定义公共路径 path = Path(__file__) ui_file_patch = path.parent.parent / "ui" / "ui_main.ui" # 从文件中加载UI定义 formType, baseType = loadUiType(str(ui_file_patch)) class Window(formType, baseType): def __init__(self): super(Window, self).__init__() self.setupUi(self) # 输出设置 self.Log_Output.document().setMaximumBlockCount(100) self.Log_Output.ensureCursorVisible() @QtCore.Slot() def start(self): self.Log_Output.append('点击了开始按钮') @QtCore.Slot() def stop(self): self.Log_Output.append('点击了停止按钮') @QtCore.Slot() def conntest(self): self.Log_Output.append('点击了测试连接按钮')