如何使按钮返回到pyqt5的上一个窗口?

我想回到我被点击的上一个窗口

我做了两个窗口。首先是Main_Menu.py,其次是Current_Stalls.py,我想通过单击“当前停顿”按钮从Main_Menu过渡到Current_Stalls。然后,在转到“当前档位”窗口后,我将按钮名称设为“返回首页”,以便返回到“主菜单”页面。但是,在编写代码后,它无法导入其他模块

主菜单程序

from PyQt5 import QtCore,QtGui,QtWidgets
from Current_Stalls import Ui_OtherWindow2
class Ui_MainWindow(object):
    def openWindow2(self):
        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_AnotherWindow()
        self.ui.setupUi(self.window)
        MainWindow.hide()
        self.window.show()

        self.current_stall = QtWidgets.QPushButton(self.centralwidget)
        self.current_stall.setGeometry(QtCore.QRect(280,200,231,41))
        self.current_stall.setobjectname("current_stall")
        self.current_stall.clicked.connect(self.openWindow2) 

当前的失速程序

from PyQt5 import QtCore,QtWidgets
from Main_Menu import Ui_MainWindow
class Ui_AnotherWindow(object):
    def openWindow(self):
        self.window = QtWidgets.QAnotherWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        AnotherWindow.hide()
        self.window.show()   

        self.backHome = QtWidgets.QPushButton(self.centralwidget)
        self.backHome.setGeometry(QtCore.QRect(600,20,161,41))
        self.backHome.setobjectname("backHome")
        self.backHome.clicked.connect(self.openWindow)
kankankankan123 回答:如何使按钮返回到pyqt5的上一个窗口?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3151863.html

大家都在问