Grid Layout Each of these buttons corresponds to a grid, in fact our widgets can occupy more than one grid, we can do a similar text input window. Below we use the source code to learn PyQt text box and grid layout.
First on the source code:
Import SYS from pyqt5.qtwidgets import qapplication, Qwidget, Qlabel, Qgridlayout, Qtextedit, Qlineedit
Class exp (qwidget):
def __init__ (self):
Super (). __INIT__ ()
Self.initui ()
def initui (self):
title = Qlabel (' title ')
author = qlabel (' author ')
review = Qlabel (' review ')
Titleedit = Qlineedit ()
Authoredit = Qlineedit ()
Reviewedit = Qtextedit ()
Grid = Qgridlayout ()
grid.setspacing (ten)
grid.addwidget (title, 1
grid.addwidget (Titleedit, , 1
grid.addwidget (author, 2
grid.addwidget (Authoredit, , 1
grid.addwidget (Review, 3
grid.addwidget (Reviewedit, , 1 5 1
self.setgeometry ( 300 Span style= "line-height:20px;font-family: ' Courier new '; font-size:10pt;" >, 300 400 400
Self.setlayout (GRID)
self.setwindowtitle (' review ')
Self.show ()
if __name__ = = ' __main__ ' :
App = Qapplication (SYS.ARGV)
ex = exp ()
Sys.exit (App.exec_ ())
parts, two parts and a Part total six parts, via qgridlayout
Grid = Qgridlayout ()
grid.setspacing (ten)
10 .
3 1 5 1
The previous 5 parts were occupied by a grid, now reviewedit occupy (3,1), (4,1), (5,1) A total of 3 meshes.
Original from: Jane book /Hammer Player
Source Explanation PyQt5 text box and grid layout