利用PyQt5实现窗口切换
下面是一个小程序,利用PyQt5实现窗口切换,希望对大家有所帮助。
```python
import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QPushButton,QDialog,QLabel
class main_windows(QWidget):
def __init__(self):
super(main_windows,self).__init__()
def setupUi(self,Form):
Form.setObjectName("Form")
Form.resize(500,500)
self.form = Form
self.btn1 = QPushButton(Form)
self.btn1.setGeometry(100,100,100,100)
self.btn1.setText("进入dialog1")
self.btn1.clicked.connect(self.slot_btn1_function)
def slot_btn1_function(self):
self.form.hide()
Form1 = QDialog()
first_Dialog = Dialog1()
first_Dialog.setupUi(Form1)
Form1.show()
Form1.exec_()
self.form.show()
class Dialog1(QWidget):
"""docstring for Dialog1"""
def setupUi(self,Dialog):
Dialog.setObjectName('Dialog')
Dialog.resize(500,500)
self.form =