PyCharm installs PyQt5 and its tools (Qt Designer, PyUIC, PyRcc) detailed tutorial

Install PyQt5, PyQt5-tools in the virtual environment of your application

actiavte 虚拟环境名

pip install PyQt5

pip install PyQt5-tools

1. Install Qt Designer

1. Click "File" in the menu bar, a drop-down box will pop up, select "Setting", and the setting interface will pop up. Select "Tools" → "External Tools" in the setting interface, the operation of this part is shown in the figure below:

 Click the "plus sign" button to create a new tool, and the tool configuration interface will pop up: fill in "Qt-Designer" in the "Name" column; fill in the designer.exe file location in the "Program" column, and my location here is: "E:\Your virtual environment\Lib\site-packages\pyqt5_tools\Qt\bin\designer.exe" (to be filled in according to the actual situation); fill in "$FileDir$" in the "Working directory" column. Finally click "OK", as shown below:

2. PyUIC 

1. Add the PyUIC tool in the same way as above, click the "plus" button, and fill in "PyUIC" in the Name column of the pop-up edit setting box;

2. Fill in the file path of the pyuic5.exe program in Program, which is generally in "Python environment directory\Scripts\pyuic5.exe" (here needs to be modified according to the actual situation), or you can click the folder selection button on the right to browse the folder select the location;

3. Fill in the content in Arguments as follows:

$FileName$ -o $FileNameWithoutExtension$.py

 4. Fill in the contents of the Working directory as follows:

$FileDir$

                                                        

 3. PyRcc

1. The configuration method of the PyRcc tool is similar to that of PyUIC. Also click the "plus" button in the "External Tools" setting, and fill in "PyRcc" in the "Name" column of the setting box:

2. Fill in the file path of the program pyrcc5.exe in Program, usually in "Python environment directory\Scripts\pyrcc5.exe" (this needs to be modified according to the actual situation), or click the folder selection button on the right to browse the folder select the location;

 3. Fill in the content in Arguments as follows:

$FileName$ -o $FileNameWithoutExtension$.py

 4. Fill in the contents of the Working directory as follows:

$FileDir$

                                                                                               

 4. Demonstration

1. The installation and configuration of dependent packages and tools is complete. The following briefly demonstrates 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 three tools set before, select "Qt Designer" to open the Qt design tool, the steps are shown in the following figure:

Guess you like

Origin blog.csdn.net/weixin_45888522/article/details/130154269