In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to use pyqt5 development programs in python, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
In this section, we use pyqt5 to develop programs. Below, we briefly analyze the knowledge points of the generated code:
The generation of interface is based on PyQt5 library.
The library comes from the pip pipeline download command, for example
Pip install pyqt5-I https://pypi.tuna.tsinghua.edu.cn/simple
Sys module is responsible for operating modules such as system files.
QtWidgets is the base class of all qt controls.
QApplication is simply understood as the process of the program, and the code is instantiated as the object app.
The main function of app.exec_ () is to use an endless loop to listen for events such as interface controls such as close buttons.
_ _ name__ when this file is running, the result is _ _ main__
Use _ _ name__=='__main__' to simulate the main entry of the python program
In order to make us more familiar with the code generated after qtdesigner design, we will use more pure pyqt5 code to write programs in the future. Of course, after we are familiar with it, we can directly use qtdesigner to directly and quickly develop the interface.
In our case in this section, we use QtWidgets to write the first program, based on pyqt5.
Write the first pyqt5 program in pure code, with the following source code:
Import sysfrom PyQt5.QtWidgets import QApplication,QWidget
If _ _ name__=='__main__': app = QApplication (sys.argv) w=QWidget () w.resize (400300) w.setWindowTitle ("Liu Jinyu programming") w.move (200300) w.show () sys.exit (app.exec_ ()) after reading the above, do you have any further understanding of how to use pyqt5 to develop programs in python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.