(我如何链接两个文件(两个对话框)) 当我点击Open Second时,我想转到另一个页面(窗口)
以下是两个文件的代码
Home.py
from PyQt5 import QtGui
import sys
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication, QLabel
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
btn = QPushButton('Open Second', self)
if __name__ == '__main__':
app = QApplication(sys.argv)
MW = MainWindow()
MW.show()
sys.exit(app.exec_())
SecondWindow.py
from PyQt5 import QtGui
import sys
from PyQt5.QtWidgets import QMainWindow, QPushButton, QApplication, QLabel
class SecondWindow(QMainWindow):
def __init__(self):
super(SecondWindow, self).__init__()
if __name__ == '__main__':
app = QApplication(sys.argv)
MW = SecondWindow()
MW.show()
sys.exit(app.exec_())