In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to understand the basic process of PyCharm using pyQT5 for GUI development. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
Only as a record of the basic operating process without detailed description
1. Environmental installation 1. Installation of Pycharm
Download the latest version of Pycharm and install it on the official website.
2. Install pyQT5
Pycharm-File-Seting
In Python Interpreter under the project, install the following three libraries
The original source is foreign, the speed is relatively slow, you can use domestic sources.
Configuration Source:
Tsinghua Source: https://pypi.tuna.tsinghua.edu.cn/simple/
3. Create a project
Set the location of the project and the path of the virtual environment. Note that the interpreter selects the address of Python.EXE.
2. Configure extension tools 1. Configure Qt Designer
Configure the startup address of Qt Designer
Program: configure according to your own path
D:\ pyQTDevelop\ venv\ Lib\ site-packages\ QtDesigner\ designer.exe
Work path:
$ProjectFileDir$
2. Configure the conversion tool
Configure the conversion tool from ui to py files
Program path:
D:\ pyQTDevelop\ venv\ Scripts\ python.exe
Parameters:
-m PyQt5.uic.pyuic $FileName$-o $FileNameWithoutExtension$.py
Path:
$FileDir$
3. GUI design 1. Open Qt Designer
2. GUI programming
New-develop-Save
Programming (this part is not introduced, this article mainly records the whole development process)
3. Convert the ui file to .py
Convert the saved .ui file to a .py program
Select the ui file that needs to be converted and run the extension
4. Add the main program
In the generated .py file, you need to add main code to run properly
Import sysif _ _ name__ ='_ main__': app=QtWidgets.QApplication (sys.argv) MainWindow=QtWidgets.QMainWindow () ui=Ui_MainWindow () ui.setupUi (MainWindow) MainWindow.show () sys.exit (app.exec_ ()) IV, package release 1, install pyinstaller
2. Packing
In Terminal
Pyinstaller-F-w untitled.py
Typical usage:
Pyinstaller-- paths PyQt5 module path-F-w-- icon= window icon file path filename. Py
-- paths: specify the installation path of the third-party module
-- icon: optional, set window icon
-F,-onefile package a single file. If your code is written in a .py file, you can use this. If it is multiple .py files, don't use it.
-D,-onedir packages multiple files, generates many dependent files in dist, and is suitable for writing tool code in the form of a framework.
-K,-tk includes TCL/TK at deployment time
-a,-ascii does not contain coding. All encodings are included by default on python versions that support Unicode.
-d,-debug produces the debug version of the executable
The Windows subsystem is used for execution of the wrech talk win win wedjec. Does not open the command line when the program starts (valid for Windows only)
-cmaine talk nowindowedjingle console using console subsystem execution (default) (valid for Windows only)
After the packaging is completed, the executable file will be generated in the dist directory
Double-click to run
The above is how to understand the basic process of PyCharm using pyQT5 for GUI development. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.