In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use the pyqt5 check box QCheckBox in Python, the content is very detailed, interested friends can refer to, hope to be helpful to you.
In this section, we will explain a comprehensive case.
The case is an event application about the status of the check box.
The frame where the check box is located
Actual combat example interface
I. the format of the check box
Use the control QCheckBox
Use format:
Variable object = QCheckBox (display text, parent container)
The parent container here can be of type Qwidget
The Qframe in our case is essentially a QWidget.
Second, the state change signal of the check box
Using the stateChanged signal, note that this signal can pass a parameter, which is of type int.
Use format:
Self. Check box. StateChanged.connect (self.myState) check box. State change signal [integer parameter] .connect (custom method in class)
Use case:
Self.ck1.stateChanged [int] .connect (self.myState)
Question: how to distinguish the different controls transmitted by the signal?
The distinction can be made directly through the sender method of the self object.
3. Enumerations in Qt
The so-called enumeration is actually using a symbol to express a meaning, in qt customized some words to represent some special numbers, these values are often used. There are many enumerated classes in Qt that say: for example, the selected check box we learned today uses a 2 corresponding representation of Qt.Checked to write enumerated types. The advantage is that it is convenient for us to read the code.
IV. Summary and emphasis
1. Master the state change event statechanged of the check box
two。 Learn about qt enumeration
3. Master the application method of putting controls into containers with qframe
On how to use the pyqt5 check box in Python QCheckBox to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.