QButtonGroup, QHBoxLayout, and QVBoxLayout
Understand how we use QButton, QHBoxLayout, and QVBoxLayout widgets in our GUI applications.
We'll cover the following
The QButtonGroup class
It's common to group some checkboxes or buttons to manage them more easily. Fortunately, PyQt offers the QButtonGroup
class that can be used to group and organize buttons and make them mutually exclusive. This is also useful if you want one checkbox selected at a time.
QButtonGroup
is a container to which widgets can be added rather than being a widget itself. As a result, adding QButtonGroup
to a layout is not possible. The way for importing and setting up QButtonGroup
in your program is demonstrated by the code below:
Get hands-on with 1200+ tech skills courses.