当前位置:网站首页>Pyqt5 rapid development and practice 6.1 three dimensions of good software & 6.2 layout management in pyqt5 & 6.3 absolute location layout of pyqt5
Pyqt5 rapid development and practice 6.1 three dimensions of good software & 6.2 layout management in pyqt5 & 6.3 absolute location layout of pyqt5
2022-07-29 09:26:00 【Ding Jiaxiong】
PyQt5 Rapid development and actual combat
List of articles
6. The first 6 Chapter PyQt5 Layout management
6.1 The three dimensions of good software
It works
This is the most basic and important measurement , It is mainly used to measure whether the product demand is reasonable , Is the right direction .
Easy to use
It mainly depends on whether the layout management architecture of the software is reasonable , Can you find what you want quickly , Whether the whole interaction process is clear , Whether the user gets stuck in the process of completing a task .
To use
A friendly 、 Humanized software interface , It will make users feel good about the software they use .
The importance of the three dimensions : To use > Easy to use > It works
6.2 PyQt5 Layout management in
Layout management : Absolute position and layout class .
layout : Horizontal layout 、 Vertical layout 、 Grid layout 、 Form layout .
Layout method :addLayout() 【 Insert sub layout in layout 】、 addWidget()【 Insert control in layout 】
The four layout methods correspond to four layout classes :
- Horizontal layout class (QHBoxLayout), You can arrange the added controls in the horizontal direction .
- Vertical layout class (QVBoxLayout), You can arrange the added controls in the vertical direction .
- Grid layout class (QGridLayout), You can arrange the added controls in the form of a grid .
- Form layout class (QFormLayout), You can arrange the added controls in two columns .
6.3 PyQt5 Absolute position layout of
Absolute position layout (Absolute Positioning Layout) It is mainly realized by specifying the display coordinates and size of each control in the window program . The initial coordinates are in the upper left corner (0,0) The location of , With (0,0) Locate the specific position of a point in the window for the origin . The representation of display coordinates is (x,y),x Abscissa , Change from left to right ;y Ordinate , Change from top to bottom . In absolute position layout , The controls in the window are laid out in absolute positions .
import sys
from PyQt5.QtWidgets import QWidget , QLabel , QApplication
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
lb1 = QLabel(" Welcome ",self)
lb1.move(15,10)
lb1 = QLabel(" Ding Jiaxiong ", self)
lb1.move(35, 40)
lb1 = QLabel("!", self)
lb1.move(55, 70)
self.setGeometry(300 , 300 , 320 , 120)
self.setWindowTitle(" Absolute position layout case ")
if __name__ == '__main__':
from pyqt5_plugins.examples.exampleqmlitem import QtCore
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
app = QApplication(sys.argv)
myWin = Example()
myWin.show()
sys.exit(app.exec_())

Advantages of absolute location layout :
- You can directly locate the location of each control .
Disadvantages of absolute position layout :
- If you change the size of a window , The size and position of controls in the window will not change .
- The generated windows may look different under different operating systems .
- Changing the font in the program may damage the layout .
- If you modify the layout , For example, add a new control , It must be completely rearranged , Cumbersome and time-consuming .
边栏推荐
- How to choose effective keywords
- Data representation and calculation (base)
- How does xjson implement four operations?
- dataframe.to_sql() 一次性插入过多报错
- [苹果开发者账号]06 转让开发者账号后,开发者年费自动续费问题
- 乱打日志的男孩运气怎么样我不知道,加班肯定很多
- The gold content of PMP certificate has been increased again and included in the scope of Beijing work residence permit
- 核酸扫码登记体验有感(如何提高OCR的文字正确识别率)
- Introduction to translation professional qualification (level) examination
- Summary of research on endogenous information security technology of industrial measurement and control equipment
猜你喜欢

Excellent package volume optimization tutorial

How to export the old and new file names and locations to excel after file renaming

Summary of some experiences in the process of R & D platform splitting

机器学习之分类模型评估指标及sklearn代码实现

MySQL error summary

先序遍历/后序遍历确定树的大致形态

Tesseract图文识别--简单

Qmainwindow details

Could not receive a message from the daemon

How to query express logistics and filter out no information doc No. to delete or copy
随机推荐
A structured random inactivation UNET for retinal vascular segmentation
Excellent package volume optimization tutorial
Axurerp prototype design starts quickly
Unity guidance system. Click the target object and prompt the text to change color to enter the next step
MySQL事务与MVCC如何实现的隔离级别
分布式Session共享的4类技术方案,与优劣势比较
NFA determination and DFA minimization based on C language
1.2.24 fastjson deserialization templatesimpl uses chain analysis (very detailed)
AxureRP原型设计 快速开始
网络安全(6)
C # use restsharp library to realize post request
Study and exploration of Redux API implementation of Redux
附录2-一些简单的练习
Discussion on the integration of storage and calculation and the calculation in storage
使用cpolar发布树莓派网页(cpolar隧道的完善)
Retinal Vessel Segmentation via a Semantics and Multi-Scale Aggregation Network
简述堆和栈的区别
"Defects" of prototype chain inheritance and constructor inheritance
Floweable foundation Chapter 1
The gold content of PMP certificate has been increased again and included in the scope of Beijing work residence permit