Installation of PyQt5
The construction of the entire environment , the main content is: Python + PyCharm + PyQt5
Recommended video URL for learning the pyqt5 production interface:
https://www.bilibili.com/video/BV1YT4y1r7tK?spm_id_from=333.999.0.0&vd_source=da469f8dadbc58a00f885b3f7be5ef05
Configuration tools: Qt Designer , PyUIC and PyRcc
1. Install pyqt
Configure Designer and test whether Designer is successful
Qt Designer uses drag and drop to place controls and view the control effects in real time for quick UI design. The new screen is as shown below.
The composition of the entire picture:
( 1 ) The "Widget Box" on the left is a variety of components that can be freely dragged
( 2 ) The “MainWindow – untitled” form in the middle is the canvas
( 3 ) The "Object Inspector" on the upper right can view the structure of the current ui
( 4 ) The "Property Editor" in the middle of the right side can set the properties of the currently selected component.
( 5 ) The "Resource Browser" on the lower right can add various materials, such as pictures, backgrounds, etc.
Finally, a .ui file (essentially a file in XML format) is generated, which can be used directly or converted into a .py file through the pyuic5 tool.
1. First determine the file location of designer.exe:
Here you can also set the following symbols directly as shortcut keys to the desktop, and you can directly open the interface.
E:\Anaconda\envs\cv2\Lib\site-packages\qt5_applications\Qt\bin\designer.exe
2. Configuration
3. Test successful
2. Configure PyUIC and test whether PyUIC is successful
1. First confirm whether PyUIC5.exe exists
E:\Anaconda\envs\cv2\Scripts\pyuic5.exe
2. Configure PyUIC5
-m PyQt5.uic.pyuic $FileName$ -o $FileNameWithoutExtension$.py
$FileDir$
3. Test successful
First create a new interface as follows , drag and drop a few controls onto the form as shown below, and then save it as a *ui file
3. Configure PyRcc and test whether PyRcc is successful
1. View the PyRcc path
E:\Anaconda\envs\cv2\Scripts\pyrcc5.exe
2. Configuration
$FileName$ -o $FileNameWithoutExtension$_rc.py
$FileDir$