Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Change UI within same window PyQt

# 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 :: how to save xml file in python 
Python :: pandas get indices of mask 
Python :: print A to Z in python uppercase 
Python :: export ifc dataframe python 
Python :: coreurls.py' does not appear to have any patterns in it. If you see valid patterns in the file then the issue is probably caused by a circular import. 
Python :: with suppress(exception) python 
Python :: csv utf-8 to iso-8859-1 python 
Python :: update python 
Python :: star question in pyton 
Python :: Jupyter get cell output 
Python :: #Combine two sets on python with for loop: reverse way in one line with space 
Python :: numpy array filter and count 
Python :: is reversed a generator python 
Python :: Filter xarray 
Python :: converting from series to dataframe with tabulate 
Python :: 144/360 
Python :: module django contrib admin has no attribute action ACTION_CHECKBOX_NAME 
Python :: install first person controller python 
Python :: how to make python faster 
Python :: splitting x,y using iloc 
Python :: python forward and bachward seperators 
Python :: how to use wbtools in python 
Python :: Ordering column names sensibly in pandas 
Python :: combining sparse class 
Python :: matplotlib plt.sapect 
Python :: python resample time series 
Python :: how to print the fibonacci sequence in python using while loop 
Python :: pandas continues update csv with exception 
Python :: Python regex emailadres no jpg 
Python :: test api register user 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =