打开对话框(窗口)表单文件PyQt5

时间:2018-03-20 10:32:18

标签: python-3.x pyqt pyqt5 windows-applications

(我如何链接两个文件(两个对话框)) 当我点击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_())

0 个答案:

没有答案