Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Multiple page PyQt QStackedWidget

# consider QStackedLayout as well

import os
import sys
from PyQt5 import QtCore, QtGui, QtWidgets, uic

ui_folder = os.path.join("frontend", "ui")
about_company_ui, _ = uic.loadUiType(os.path.join(ui_folder, "about_company.ui"))
intern_placement_ui, _ = uic.loadUiType(os.path.join(ui_folder, "intern_placement.ui"))


class InternPlacement(QtWidgets.QMainWindow, intern_placement_ui):
    def __init__(self, parent=None):
        super(InternPlacement, self).__init__(parent)
        self.setupUi(self)


class AboutCompany(QtWidgets.QMainWindow, about_company_ui):
    def __init__(self, parent=None):
        super(AboutCompany, self).__init__(parent)
        self.setupUi(self)


if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)
    intern_window = InternPlacement()
    about_window = AboutCompany()
    w = QtWidgets.QStackedWidget()
    w.addWidget(intern_window)
    w.addWidget(about_window)
    intern_window.intern_pushButton.clicked.connect(lambda: w.setCurrentIndex(1))
    w.resize(640, 480)
    w.show()
    sys.exit(app.exec_())
Comment

PREVIOUS NEXT
Code Example
Python :: pandas cummax 
Python :: when to use python sets 
Python :: kill os system by pid python script 
Python :: Python Program to Find sum Factorial of Number Using Recursion 
Python :: comparing dict key with integer 
Python :: airflow find trigger type 
Python :: pomodoro timer in python 
Python :: flask base __init__.py file 
Python :: biggest number 
Python :: comment on inclut date et heure en python svp 
Python :: #Combine two sets on python with for loop 
Python :: list devices python 3 
Python :: Make Latest pyhton as default in mac 
Python :: Filter xarray (dataarray) 
Python :: Groupby geek link 
Python :: pyglet template 
Python :: django admin link column display links 
Python :: circular reference detected python repl.it 
Python :: pandas read float numbers with coma 
Python :: django column to have duplicate of other 
Python :: How to count a consecutive series of positive or negative values in a column in python 
Python :: napalm cli 
Python :: duplicate finder python modules 
Python :: converting 4hr 20min to minutes 
Python :: convert math expression as string to int 
Python :: remove brackets from string python 
Python :: generate fibonacci series in python 
Python :: pandas continues update csv 
Python :: problems on loops and if else statements 
Python :: test register user mismatched passwords 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =