Source Explanation PyQt5 text box and grid layout

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.