Table of contents
1. Install pycharm and python version
2. Upgrade pip and change source, install PyQt5, PyQt5-tool
4. Add 3 tools to pycharm's external tools
4.1. Add three plug-ins (emphasis)
1. Install pycharm and python version
Download PyCharm: Python IDE for Professional Developers by JetBrains
Professional: professional version, paid, full-featured
Community: community version, free, functional castrationpython-3.9.5-amd64.exe_Free high-speed download|Baidu network disk-unlimited sharing (baidu.com)
https://pan.baidu.com/s/1EcamXl5iRS0X8vmn8sbk2w#list/path=%2F The above installation package has been given, you can download directly
2. Upgrade pip and change source, install PyQt5, PyQt5-tool
1. Upgrade pip
python -m pip install --upgrade pip
2. Change source
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple pip config set install.trusted-host mirrors.aliyun.com
3. Install PyQt5, PyQt5-tool
pip install PyQt5 pip install PyQt5-tools
3. Add environment variables
1. Find the absolute path and copy it down (everyone’s path is different, find it yourself)
D:\Program Files\Python39\Lib\site-packages\pyqt5_tools
2. Create a new environment variable
3. Write environment variables
4. Add 3 tools to pycharm's external tools
Add three plug-ins (emphasis)
QtDesigner—UI design through Qt language (support drag-and-drop UI design)
PyUIC—mainly used to convert QtDesigner code into Python code
Pyrcc—package pictures and data file resources into py document
4.1. Add three plug-ins (emphasis)
Open Pycharm, open File—>Settings—>External Tools , click the plus sign to import the tool
1. Add QtDesigner
Name:QtDesigner Group:External Tools Program:D:\Program Files\Python39\Lib\site-packages\qt5_applications\Qt\bin\designer.exe Arguments:$FileDir$\$FileName$ Working directory:$FileDir$
Note: Program needs to find the designer.exe downloaded by itself
2. Add pyuic5
Name:pyuic5 Group:External Tools Program:D:\Program Files\Python39\Scripts\pyuic5.exe Arguments:$FileName$ -o $FileNameWithoutExtension$.py Working directory:$FileDir$
3. Add pyrcc
Name:pyuic5 Group:External Tools Program:D:\Program Files\Python39\Scripts\pyrcc5.exe Arguments:$FileName$ -o $FileNameWithoutExtension$.py Working directory:$FileDir$
5. How to use QtDesigner
1. Open the interface, click QtDesigner to enter the interface
2. This is the running interface
3. Interface layout
4. Use the left control by yourself to design the interface
5. Ctrl+c saves the file as a .ui file (you can close the page)
6. How to use pyuic5
1. Select the .py file to be converted, and then click pyuic5 to convert the py file into a .ui file
2. Rendering
7. How to use Pyrcc
1. Open QtDesigner and choose to edit resources
2. Create a new resource file and save it anywhere
3. Name it according to your preferences, and then add resources
4. Save and exit
5. Select the .qrc file, then click pyrcc to convert it to a .py file, and then we can quote it
6. Learning video:
The role of the 3 tools
QtDesigner: Provides a visual user interface (UI) design function, enabling users to drag and drop to build and arrange multiple different controls on the interface. The supported control types include: window, label, text box, Buttons and other common user interface components. The UI file generated by QtDesigner design can be passed to PyUIC as a parameter to generate the Python code file.
PyUIC: A tool that converts QtDesigner code into Python code, enabling users to visually design and generate UI files in QtDesigner that can be used in Python programs through the PyQt5 library. Through the conversion of PyUIC, users can use the UI file designed by QtDesigner in the Python program, and realize more complex interactive functions by further writing logic on the creation, combination and binding methods of UI controls.
Pyrcc: Package pictures and data file resources into Py files, which is a tool for packaging resource files. When using QtDesigner and PyUIC, if you need to package images, sounds, fonts or other data files into Py files, you can also use Pyrcc. Using Pyrcc, external data files can be packaged into built-in processing, so that the program has good portability and reduces the problems of scattered files and difficult maintenance.