May 2019
Intermediate to advanced
542 pages
13h 37m
English
QPushButton is a simple, clickable button widget. Like QLabel and QLineEdit, it can be called with a first argument that specifies the text on the button, like so:
button = qtw.QPushButton("Push Me", self)
Some of the more useful properties we can set on QPushButton include the following:
| Property | Arguments | Description |
|---|---|---|
| checkable | Boolean | Whether the button stays on when pressed. |
| checked | Boolean | For checkable buttons, whether the button is checked. |
| icon | QIcon | An icon image to display on the button. |
| shortcut | QKeySequence | A keyboard shortcut that will activate the button. |
The checkable and checked properties allow us to use this button as a toggle button that reflects an on/off state, rather than ...
Read now
Unlock full access