from PyQt5.QtWidgets import * class Widget1(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent=parent) layout = QFormLayout(self) LineEditGraf = QLineEdit("график 1") NameX=QGroupBox("X") NameY = QGroupBox("Y") LineEditX = QLineEdit() LineEditY = QLineEdit() layout.addWidget(LineEditGraf) layout.addWidget(NameX) layout.addWidget(LineEditX) layout.addWidget(NameY) layout.addWidget(LineEditY) class Widget2(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent=parent) layout = QHBoxLayout(self) # Кнопки функций VariabelsButton_t = QPushButton('t', self) #VariabelsButton_t.clicked.connect(self.on_click) layout.addWidget(VariabelsButton_t) VariabelsButton_p = QPushButton('p', self) # VariabelsButton_p.clicked.connect(self.on_click) layout.addWidget(VariabelsButton_p) VariabelsButton_f = QPushButton('f', self) # VariabelsButton_f.clicked.connect(self.on_click) layout.addWidget(VariabelsButton_f) class Widget3(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent=parent) layout = QHBoxLayout(self) # Кнопки функций FunctonButton_exp = QPushButton('exp', self) #FunctonButton_exp.clicked.connect(self.on_click) layout.addWidget(FunctonButton_exp) FunctonButton_ln = QPushButton('ln', self) #FunctonButton_ln.clicked.connect(self.on_click) layout.addWidget(FunctonButton_ln) FunctonButton_abs = QPushButton('abs', self) #FunctonButton_abs.clicked.connect(self.on_click) layout.addWidget(FunctonButton_abs) FunctonButton_sin = QPushButton('sin', self) #FunctonButton_sin.clicked.connect(self.on_click) layout.addWidget(FunctonButton_sin) FunctonButton_cos = QPushButton('cos', self) #FunctonButton_cos.clicked.connect(self.on_click) layout.addWidget(FunctonButton_cos) FunctonButton_tg = QPushButton('tg', self) #FunctonButton_tg.clicked.connect(self.on_click) layout.addWidget(FunctonButton_tg) class stackedExample(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent=parent) lay = QVBoxLayout(self) self.Stack = QStackedWidget() self.Stack.addWidget(Widget1()) self.Stack.addWidget(Widget2()) self.Stack.addWidget(Widget3()) btnNext = QPushButton("Next") btnNext.clicked.connect(self.onNext) btnPrevious = QPushButton("Previous") btnPrevious.clicked.connect(self.onPrevious) btnLayout = QHBoxLayout() btnLayout.addWidget(btnPrevious) btnLayout.addWidget(btnNext) lay.addWidget(self.Stack) lay.addLayout(btnLayout) def onNext(self): self.Stack.setCurrentIndex((self.Stack.currentIndex()+1) % 3) def onPrevious(self): self.Stack.setCurrentIndex((self.Stack.currentIndex()-1) % 3) if __name__ == '__main__': import sys app = QApplication(sys.argv) w = stackedExample() w.show() sys.exit(app.exec_())