我想回到我被点击的上一个窗口
我做了两个窗口。首先是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)