Python uses Qt to visually develop form applications

1. First download the qt development tools, the documentation is very clear

  • method one:

(This article uses this download and installation method)

Official download link library: https://download.qt.io/ https://download.qt.io/ Installation documentation: http://c.biancheng.net/view/3851.html http://c.biancheng .net/view/3851.html

  • Method Two:

Install PyQt5-tools using pip (same as downloading the development tools directly):  

pip install  pyqt5-tools

Many blogs say to use the first one, but they report an error, and I won't say the reason. I use the following one:  

pip install pyqt5-tools -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

2. Install QT5 using pip:

pip install pyqt5

4. Write Python code to run


from PyQt5 import QtWidgets, QtGui
import sys

app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QWidget();
window.show()
sys.exit(app.exec_())

The following interface appears, indicating that the installation is successful

 5. Install Qt Creator and open it as shown below

 6. Pycharm adds QtDesigner (that is, the startup program of the development tool you downloaded and installed)

 7. Pycharm adds PyUIC

  • Name:PyUIC
  • Program: C:\Users\Administrator\AppData\Local\Programs\Python\Python310\Scripts\pyuic5.exe                 Note: This path is in the Scripts folder under your Python installation path
  • Arguments:$FileName$ -o $FileNameWithoutExtension$.py
  • Working dirctory:$FileDir$

Guess you like

Origin blog.csdn.net/baidu_39105563/article/details/122980275