-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
50 lines (41 loc) · 1.81 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import sys
class logindialog(QDialog):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setWindowTitle('登录界面')
self.resize(200, 200)
self.setFixedSize(self.width(), self.height())
self.setWindowFlags(Qt.WindowCloseButtonHint)
self.frame = QFrame(self)
self.verticalLayout = QVBoxLayout(self.frame)
self.lineEdit_account = QLineEdit()
self.lineEdit_account.setPlaceholderText("请输入账号")
self.verticalLayout.addWidget(self.lineEdit_account)
self.lineEdit_password = QLineEdit()
self.lineEdit_password.setPlaceholderText("请输入密码")
self.verticalLayout.addWidget(self.lineEdit_password)
self.pushButton_enter = QPushButton()
self.pushButton_enter.setText("进入下一个界面")
self.verticalLayout.addWidget(self.pushButton_enter)
self.frame1 = QFrame(self)
self.verticalLayout = QVBoxLayout(self.frame1)
self.pushButton_quit = QPushButton()
self.pushButton_quit.setText("回到主页面")
self.verticalLayout.addWidget(self.pushButton_quit)
self.frame1.setVisible(False)
self.pushButton_enter.clicked.connect(self.on_pushButton_enter_clicked)
self.pushButton_quit.clicked.connect(self.on_pushButton_enter_clicked_1)
def on_pushButton_enter_clicked(self):
self.frame1.setVisible(True)
self.frame.setVisible(False)
def on_pushButton_enter_clicked_1(self):
self.frame1.setVisible(False)
self.frame.setVisible(True)
if __name__ == "__main__":
app = QApplication(sys.argv)
dialog = logindialog()
if dialog.exec_() == QDialog.Accepted:
sys.exit(app.exec_())