1. Install PyQt5 and Qt Designer
After pressing win+R, enter cmd,
pip install pyqt5
pip install pyqt5-tools
Due to network and other reasons, the installation may fail, you can use
pip install pyqt5-tools -i https://pypi.tuna.tsinghua.edu.cn/simple
Installation path: C:\Users\fylal\AppData\Local\Programs\Python\Python37\Lib\site-packages\qt5_applications\Qt\bin
2. Configure in pycharm
File-settings-Tools-External Tools, then click the plus sign, and configure as follows.
Configure pyuic to directly convert ui files to py files
The installation and configuration of dependent packages and tools is complete. Here is a brief demonstration of how to use it. First open or create a new Python project, click " Tools " in the menu bar , select " External Tools ", you can see the two tools set up before, select " Qt Designer " to open the Qt design tool, the steps are shown in the following figure:
Common components
After clicking QtDesigner, or click designer.exe under the installation path, click Create.
Common components:
- Confirm key (PushButton)
Can change object name and style etc.
- label
Styles and object names can also be changed
-
Text Edit (text input box)
-
Line Edit (often used for account and password input)
-
Horizontal/Vertical Line (can be used for area division lines)
Press ctrl+R to preview
- Edit signal/slot
If you choose to clear, click the button, the text of text will be cleared
Multiple signal slots can be connected
Save the ui interface as a .py file
First save the designed interface as a .ui file
- in pycharm
- terminal to convert
run, the result is: