您必须使用
QStackedWidget
import osimport sysfrom PyQt5 import QtCore, QtGui, QtWidgets, uicui_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_())
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)