forked from geekori/pyqt5
-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathFormLayout.py
More file actions
39 lines (26 loc) · 819 Bytes
/
FormLayout.py
File metadata and controls
39 lines (26 loc) · 819 Bytes
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
'''
表单布局(QFormLayout)
'''
import sys,math
from PyQt5.QtWidgets import *
class FormForm(QWidget) :
def __init__(self):
super(FormForm,self).__init__()
self.setWindowTitle("表单布局")
self.resize(350,300)
formLayout = QFormLayout()
titleLabel = QLabel('标题')
authorLabel = QLabel('作者')
contentLabel = QLabel('内容')
titleEdit = QLineEdit()
authorEdit = QLineEdit()
contentEdit = QTextEdit()
formLayout.addRow(titleLabel,titleEdit)
formLayout.addRow(authorLabel,authorEdit)
formLayout.addRow(contentLabel,contentEdit)
self.setLayout(formLayout)
if __name__ == '__main__':
app = QApplication(sys.argv)
main = FormForm()
main.show()
sys.exit(app.exec_())