May 2019
Intermediate to advanced
542 pages
13h 37m
English
QGroupBox provides a panel that is labeled and (depending on the platform style) bordered. It's useful for grouping related input together on a form. We create the QGroupBox just as we would create a QWidget container, except that it can have a border and a title for the box, for example:
groupbox = qtw.QGroupBox('Buttons') groupbox.setLayout(qtw.QHBoxLayout()) groupbox.layout().addWidget(qtw.QPushButton('OK')) groupbox.layout().addWidget(qtw.QPushButton('Cancel')) layout.addWidget(groupbox)
Here, we create a group box with the Buttons title. We gave it a horizontal layout and added two button widgets.
Notice in this example, instead of giving the layout a handle of its own as we've been doing, we create an anonymous QHBoxLayout ...
Read now
Unlock full access