Field Notes
Engineering

Getting Started with PyQt5

Installation, Qt Designer, and a tour of the modules.

1 min read

Installation
Installing for multiple Python versions

py -3.x -m pip install xxx

py -3.8 pip install PyQt5
py -3.8 -m pip install PyQt5-tools


design.exe location
C:\Users\xxx\AppData\Local\Programs\Python\Python38\Lib\site-packages\qt5_applications\Qt\bin

Converting a UI file to a Python file

-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py

For example
-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
PyQt5 is made up of a collection of Python modules, with over 620 classes and 6000 functions and methods. The main modules are as follows:

QtCore: contains the core non-GUI functionality. Mainly used with time, files and folders, various data, streams, URLs, MIME-type files, processes, and threads.
QtGui: contains the window system, event handling, 2D graphics, basic painting, fonts, and text classes.
QtWidgets: contains a set of UI elements for building desktop applications.
QtMultimedia: contains classes for handling multimedia content and calling the camera API.
QtBluetooth: contains classes for discovering and connecting to Bluetooth devices.
QtNetwork: contains classes for network programming; these tools make TCP/IP and UDP development more convenient and reliable.
QtPositioning: contains positioning classes that can use satellites, WiFi, and even text.
Enginio: contains classes for accessing and managing Qt Cloud from a client.
QtWebSockets: contains classes for the WebSocket protocol.
QtWebKit: contains a web browser based on WebKit2.
QtWebKitWidgets: contains classes based on QtWidgets for WebKit1.
QtXml: contains classes for handling XML, providing tools for the SAX and DOM APIs.
QtSvg: provides classes for displaying SVG content; Scalable Vector Graphics (SVG) is a graphics format based on the Extensible Markup Language (XML) used to describe two-dimensional vector graphics (this sentence comes from Wikipedia).
QtSql: provides tools for working with databases.
QtTest: provides tools for testing PyQt5 applications.

Three ways to generate a Python file from a UI file https://blog.csdn.net/weixin_43693650/article/details/113109436https://zhuanlan.zhihu.com/p/457972006

Virtual environments on Linux ​

bash
sudo apt install python3 python3-pip python3-venv
python3 -m venv your_python_env_name