📜  python 打开多个 .py 窗口 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:44.416000             🧑  作者: Mango

代码示例1
class HomeWindow(QMainWindow, Ui_HomeWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent=parent)
        self.setupUi(self)


class ValveSim(QMainWindow, Ui_ValveSim):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent=parent)
        self.setupUi(self)


class Win1(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent=parent)
        self.setupUi(self)
        self.vs = ValveSim()
        self.hw = HomeWindow()
        self.CreateValveSimulator()
        self.CreateWindow()

    def CreateValveSimulator(self):
        subwindow = QMdiSubWindow()
        subwindow.setWidget(self.vs)
        self.mdiArea.addSubWindow(subwindow)
        subwindow.setFixedSize(500, 500)
        # self.subwindow.close()

    def CreateWindow(self):
        self.hw.pushButton.clicked.connect(self.vs.showNormal)
        subwindow = QMdiSubWindow()
        subwindow.setWindowFlags(Qt.CustomizeWindowHint | Qt.Tool)
        subwindow.setWidget(self.hw)
        self.mdiArea.addSubWindow(subwindow)