效果如下:
按下按钮 按键1 后会出现
按下按钮 按键2 后会出现
按下按钮 按键3 后会出现
具体代码:
main.py
from PySide2.QtWidgets import QStackedLayout
from PySide2.QtWidgets import QWidget
from PySide2.QtWidgets import QApplication, QMainWindow
import sys
import Ui_main
import Ui_main_widget_1
import Ui_main_widget_2
import Ui_main_widget_3
class UiForm1(QWidget):
def __init__(self):
super(UiForm1, self).__init__()
self.ui = Ui_main_widget_1.Ui_Form()
self.ui.setupUi(self)
class UiForm2(QWidget):
def __init__(self):
super(UiForm2, self).__init__()
self.ui = Ui_main_widget_2.Ui_Form()
self.ui.setupUi(self)
class UiForm3(QWidget):
def __init__(self):
super(UiForm3, self).__init__()
self.ui = Ui_main_widget_3.Ui_Form()
self.ui.setupUi(self)
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self