当前位置:网站首页>Pyqt5 rapid development and practice Chapter 1 understanding pyqt5
Pyqt5 rapid development and practice Chapter 1 understanding pyqt5
2022-07-26 11:08:00 【Ding Jiaxiong】
PyQt5 Rapid development and actual combat
List of articles
1. The first 1 Chapter know PyQt5
1.1 PyQt Introduction to the framework
Graphical user interface → GUI
GUI yes Graphical User Interface Short for , Graphical user interface , To be exact ,GUI It is the visual experience and interactive operation of screen products .GUI It's a combination of Computer Science 、 aesthetic 、 psychology 、 Human machine system engineering of behavior and demand analysis in various business fields , Emphasize people — machine - The three environments are designed as a system .
PyQt:
PyQt Is one for creating GUI Cross platform toolkit for applications , It will Python Programming languages and Qt Libraries are successfully integrated .Qt The library is currently the most powerful GUI One of the Libraries .
The biggest problem that open source software needs to solve is how to deal with the situation that developers use open source software to achieve personal or business goals , This includes copyright and revenue issues . When a software developer plans to open source the code he writes , Usually choose free software agreement , namely GPL (GNU General Public License,GNU General public permit ). therefore ,PyQt 5 I chose GPL agreement , So developers can use it with confidence PyQt 5 Development software .
1.1.1 PyQt5 Characteristics
- Based on high performance Qt Of GUI Control set
- Can run across platforms in Windows、Linux and Mac OS Wait for the system .
- Use signal / Slot (signal / slot) Mechanism to communicate
- Yes Qt Complete encapsulation of the Library
- have access to Qt ripe IDE Graphic interface design , And automatically generate executable Python Code
- Provides a wide range of window controls .
1.1.2 Qt And PyQt The relationship between
- PyQt yes Qt Framework of the Python Language implementation .
- In terms of development speed , because PyQt The core of Qt library , Also use C++ Compiling , So even if the logic code runs slower , It will not become a performance bottleneck .
- PyQt towards Python Programmers provide complete Qt Functions of application program interface , Almost usable Python Do anything Qt What can be done .
1.1.3 Introduction to other graphical interface development libraries
Tkinter
Tkinter It's bound Python Of Tk GUI Toolset , Namely Python Packaged Tcl Code , By embedding in Python Inside the interpreter Tcl Interpreter implementation . take Tkinter Is converted to Tcl command , And then to Tcl Interpreter to explain , Realization Python Of GUI.
wxPython
wxPython yes Python For cross platform GUI Toolset wxWidgets( use C++ To write ) Packaging , As Python An extension module of .
PyGTK
PyGTK yes Python Yes GTK+GUI A series of packages of the Library .
PySide
PySide yes Python For cross platform GUI Toolset Qt Another package for , Bundle up Python among .
1.1.4 PyQt4 / PyQt5
PyQt5 No longer downward compatible PyQt 4 Written program , because PyQt5 There are several major changes .
- PyQt 5 No more Python 2.6 Previous versions provide support ,
- PytQt5 Some modules have been rebuilt , Some old modules have been discarded
- PyQt5 What is used OtWebKitWidgets modular (PyQt 5.7 Above version ) It was developed by Google team chromium Kernel engine , Because the update and maintenance speed is very fast , Basically, it perfectly supports the new things of the Internet .
- PyQt 5 Only new signals and slots are supported , The transfer of old signals and slots will no longer be supported
- PyQt 5 Does not support the Qt 5.0 Marked as abandoned or obsolete Qt API part
- PyQt 5 Release when the program needs it GIL
1.1.5 Python2 And Python3
PyQt5 Use Python3 Why :
- Python 2 The vast majority of the frameworks of the provide support for Python 3 Support for , And some new frameworks such as TensorFlow And so on, only provided right Python 3 Support for .
- about Python 2 The official support only goes to 2020 year , and PyOt 5 It's a new framework , New frameworks often do not provide much support for languages that are about to be phased out .
- Python 3 By default UTF-8 code , Seamless compatibility with Chinese strings .
- Use Python 3 Development PyQt 5, There is no need to consider the problem of Chinese coding .
- PyQt 5 The official default is only to provide Python3 Support for
1.2 PyQt5 Environment building
1.2.1 stay Windows The structures, PyQt5 Environmental Science
install Python3 Running environment
The author directly creates a virtual environment here
Python Version selected 3.8

install PyQt5
pip install PyQt5 -i https://pypi.tuna.tsinghua.edu.cn/simple
install PyQt5-tools
pip install PyQt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple
test
import sys from PyQt5 import QtWidgets,QtCore app = QtWidgets.QApplication(sys.argv) widget = QtWidgets.QWidget() widget.resize(360,360) widget.setWindowTitle("Hello,PyQt5") widget.show() sys.exit(app.exec_())
1.2.2 stay Mac OS The structures, PyQt5 Environmental Science
- install Qt
- install Python
- install SIP
- install PyQt
- test
1.2.3 PyQt5 Installation test of
help(PyQt5)

1.2.4 Install others Python modular
install matplotlib

1.2.5 Use PyQt5 Of API file
Method 1: Check... By command PyQt5 All properties of classes and objects
Method 2: Check the online help documentation
https://www.riverbankcomputing.com/static/Docs/PyQt5/
1.3 Eric 6 Installation and use
One Python Editor and IDE, use Python Written , I won't pretend here

After clicking the button , The window closed .
边栏推荐
- In depth interpretation of happens before principle
- SCADA和三大工业控制系统PLC、DCS、FCS
- Bash shell learning notes (V)
- pytest pytest. Ini configuration case grouping case skipping
- Classified by the number of 1 in binary number
- 344. Reverse string
- Pre post pytest method
- Fragment 懒加载
- @NotBlank、@NotNull 、@NotEmpty 区别和使用
- Notes on intellectual property law in Yu classroom
猜你喜欢
随机推荐
【转载】多元高斯分布(The Multivariate normal distribution)
MySQL数据库的简单使用
Bash shell learning notes (4)
pytest pytest.ini配置 用例分组 用例跳过
像素和内存的关系
Pytest execution rules_ Basic usage_ Common plug-ins_ Common assertions_ Common parameters
Smart contract DAPP system development process technology
Sword finger offer (8): jump the steps
Capture ZABBIX performance monitoring chart with selenium
SparseArray of the source code for novices
pytest 用例执行顺序
Sword finger offer (43): left rotation string
3Dunity游戏项目实战——飞机大战
List ascending and descending
Why do I need automated testing? Software testers take you to evaluate different software testing tools
AuthorizingRealm简介说明
The combination of pytest confitest.py and fixture
Definition and use of C language namespace
Bash shell learning notes (VII)
mysql学习笔记









