Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python open multiple .py windows

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)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #open #multiple #windows
ADD COMMENT
Topic
Name
2+9 =