SoFunction
Updated on 2024-11-15

vscode+PyQt5 installation detailed steps

1. default already have python environment and vscode

Installing PyQt5

Execute the command:

pip install PyQt5

pip install PyQt5-tools

3. Running

For the default installation, find the file in the \Lib\site-packages\pyqt5_tools directory and run it.

Then create and save a .ui file.

Environment Configuration

Search for PYQT integration in vscode extensions and add the extension.

Then open the folder of the .ui file you just created in vscode. Right mouse click on the file. Click on PYQT:compile Form, which will generate a .py file

5. Call the ui class you just created.

Create a new .py file

import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from Ui_welcome import Ui_MainWindow

class mywindow(,Ui_MainWindow):
  def __init__(self):
    super(mywindow,self).__init__()
    (self)

if __name__=='__main__':
  app = ()
  window = mywindow()
  ()
  (app.exec_())

Click Run to run out the .ui file you just made.

To this point this article on vscode PyQt5 installation step by step on this article, more related to vscode PyQt5 installation content, please search for my previous articles or continue to browse the following related articles I hope you will support me in the future more!