PyQt5--GridLayoutMultiLine

2018-09-18 06:43:35来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

 1 # -*- coding:utf-8 -*-
 2 '''
 3 Created on Sep 13, 2018
 4 
 5 @author: SaShuangYiBing
 6 '''
 7 import sys
 8 from PyQt5.QtWidgets import QApplication,QWidget,QGridLayout,QLabel,QLineEdit,QTextEdit
 9 
10 class New_test(QWidget):
11     def __init__(self):
12         super().__init__()
13         self.initUI()
14         
15     def initUI(self):
16         title = QLabel('Title:')
17         author = QLabel('Author:')
18         review = QLabel('Review:')
19         
20         titleEdit = QLineEdit()
21         authorEdit = QLineEdit()
22         reviewEdit = QTextEdit()
23         
24         grid = QGridLayout()
25         grid.setSpacing(10)
26         
27         grid.addWidget(title,1,0)
28         grid.addWidget(titleEdit,1,1)
29         grid.addWidget(author,2,0)
30         grid.addWidget(authorEdit,2,1)
31         grid.addWidget(review,3,0)
32         grid.addWidget(reviewEdit,3,1,3,1) # 放置在第3行第1列,占用3行且保占1列
33         
34         self.setLayout(grid)
35         
36         self.setGeometry(300,300,350,300)
37         self.setWindowTitle('Review')
38         self.show()
39         
40 if __name__ == "__main__":
41     app = QApplication(sys.argv)
42     ex = New_test()
43     sys.exit(app.exec_())
44         
45         

 

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:PyQt5--ShowTips

下一篇:PyQt5--CloseWindow