search
HomeDevelopment ToolsVSCodeA brief discussion on how to build and configure the PyQt5 environment in VSCode

How to build and configure the PyQt5 environment in

VSCode? The following article will introduce to you the installation of the PyQt5 toolkit and the method of configuring the PyQt5 environment in VSCode. I hope it will be helpful to friends in need!

A brief discussion on how to build and configure the PyQt5 environment in VSCode

Record the process of setting up the environment when learning QT. As far as I know, there is a python version and a C version for QT interface programming. The one I chose here is the python version of PyQt5

1. PyQt5 toolkit installation

is already installed by default. Python environment

  • Use the pip command to install the PyQt5 tool——pip install pyqt5

  • Then install the development tool QT designer——pip install pyqt5- tools

The installation path is \Lib\site-packages under your python installation path

Find the pyqt5designer.exe file under this path

A brief discussion on how to build and configure the PyQt5 environment in VSCode

This is the Qt Designer graphical interface development tool. You can choose to generate a shortcut to the desktop, and then double-click it to use it.

2. Visual Studio Code configuration

Visual Studio Code only requires two steps. [Recommended learning: "vscode introductory tutorial"]

  • Download and install the plug-in PYQT integration


    A brief discussion on how to build and configure the PyQt5 environment in VSCode

  • Set the path of pyqt5designer.exe as the default opening location

    Click the gear in the lower left corner to open the settings, search for pyqt directly, open the PYQT integration configuration in the extension, and find Pyqt integration Pyuic: Cmd As well as the two options of Pyqt integration Qtdesigner Path, just add the absolute path of the previous pyqt5designer.exe (I moved it to another location here)

A brief discussion on how to build and configure the PyQt5 environment in VSCode
A brief discussion on how to build and configure the PyQt5 environment in VSCode

3. Using PyQt5 in Visual Studio Code

You can directly use pyqt5designer for layout, or code your own code for design.

  • Using pyqt5designer: You can directly double-click pyqt5designer.exe to open the development tool (if you have generated a shortcut before)

    In order to keep the desktop clean, I did not generate it, but To use the plug-in you just installed, you can quickly open the development interface by right-clicking PYQT: new form in the file bar on the left

A brief discussion on how to build and configure the PyQt5 environment in VSCode

A brief discussion on how to build and configure the PyQt5 environment in VSCode

##Then add a control and save a .ui file

A brief discussion on how to build and configure the PyQt5 environment in VSCode

Return to vscode, open the corresponding folder, click on the .ui file, right-click and select PYQT: Compile Form , generate the corresponding .py file. This is the corresponding py code for the layout you just designed. Beginners like me can use this to learn the layout code.

A brief discussion on how to build and configure the PyQt5 environment in VSCode

A brief discussion on how to build and configure the PyQt5 environment in VSCode

  • Type the code directly: I first learned the basic use and layout of controls from other bloggers I coded all the code manually. It feels better to code by myself, and it makes me feel better when I study it. Here I will talk about a problem I encountered - that is, an error will be reported when importing pyqt5. In fact, there is no error and it can run normally

    . Later, I found a solution in [Muzi Huaner]'s article (https ://blog.csdn.net/muzihuaner/article/details/106205930)
    A brief discussion on how to build and configure the PyQt5 environment in VSCode Create a new .pylintrc file and enter the following code, the problem will be solved perfectly

  • extension-pkg-whitelist=PyQt5

4. Summary

There is no end to learning. Novices start to learn to solve problems from the blogs of big guys. , I hope everyone will work hard together! ! !

For more knowledge about VSCode, please visit:

vscode tutorial! !

The above is the detailed content of A brief discussion on how to build and configure the PyQt5 environment in VSCode. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:csdn. If there is any infringement, please contact admin@php.cn delete
Is Visual Studio Still Free? Understanding the AvailabilityIs Visual Studio Still Free? Understanding the AvailabilityApr 18, 2025 am 12:05 AM

Yes, some versions of VisualStudio are free. Specifically, VisualStudioCommunityEdition is free for individual developers, open source projects, academic research, and small organizations. However, there are also paid versions such as VisualStudioProfessional and Enterprise, suitable for large teams and enterprises, providing additional features.

Using Visual Studio: Developing Software Across PlatformsUsing Visual Studio: Developing Software Across PlatformsApr 17, 2025 am 12:13 AM

Cross-platform development with VisualStudio is feasible, and by supporting frameworks like .NETCore and Xamarin, developers can write code at once and run on multiple operating systems. 1) Create .NETCore projects and use their cross-platform capabilities, 2) Use Xamarin for mobile application development, 3) Use asynchronous programming and code reuse to optimize performance to ensure efficient operation and maintainability of applications.

How to format json with vscodeHow to format json with vscodeApr 16, 2025 am 07:54 AM

The ways to format JSON in VS Code are: 1. Use shortcut keys (Windows/Linux: Ctrl Shift I; macOS: Cmd Shift I); 2. Go through the menu ("Edit" > "Format Document"); 3. Install JSON formatter extensions (such as Prettier); 4. Format manually (use shortcut keys to indent/extract blocks or add braces and semicolons); 5. Use external tools (such as JSONLint and JSON Formatter).

How to compile vscodeHow to compile vscodeApr 16, 2025 am 07:51 AM

Compiling code in VSCode is divided into 5 steps: Install the C extension; create the "main.cpp" file in the project folder; configure the compiler (such as MinGW); compile the code with the shortcut key ("Ctrl Shift B") or the "Build" button; run the compiled program with the shortcut key ("F5") or the "Run" button.

How to install vscodeHow to install vscodeApr 16, 2025 am 07:48 AM

To install Visual Studio Code, please follow the following steps: Visit the official website https://code.visualstudio.com/; download the installer according to the operating system; run the installer; accept the license agreement and select the installation path; VSCode will start automatically after the installation is completed.

How to enlarge fonts with vscodeHow to enlarge fonts with vscodeApr 16, 2025 am 07:45 AM

The methods to enlarge fonts in Visual Studio Code are: open the settings panel (Ctrl, or Cmd,). Search and adjust "Font Size". Choose "Font Family" with the right size. Install or select a theme that provides the right size. Use keyboard shortcuts (Ctrl or Cmd) to enlarge the font.

How to connect to a remote server with vscodeHow to connect to a remote server with vscodeApr 16, 2025 am 07:42 AM

How to connect to a remote server through VSCode? Install Remote - SSH Extended Configuration SSH Create a Connection in VSCode Enter connection information: Host, Username, Port, SSH Key Double-click the saved connection in Remote Explorer

How to run vue with vscodeHow to run vue with vscodeApr 16, 2025 am 07:39 AM

Running a Vue project in VSCode requires the following steps: 1. Install the Vue CLI; 2. Create a Vue project; 3. Switch to the project directory; 4. Install project dependencies; 5. Run the development server; 6. Open the browser to visit http://localhost:8080.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools