pyqt5 groupbox

You can place widgets inside a grid. A grid can contain groups, where each group has one or more widgets.


Related course:


A groupbox and grid can be created with PyQt. It works like this:

  1. A PyQt5 window can contain a grid.
  2. A grid can contain any number of groups
  3. groups can contain widgets (buttons, texts, images).

A grid can be created with the class QGridLayout. As you’d expect, the grid layout has to be added to the window. A groupbox is created with the class QGroupBox.

Groupbox Example

The code below creates a 2×2 groupbox in a window. We create a groupbox using QGridLayout. This in turn can have widgets. Widgets are added using the method addWidget(widget, x,y).


Previous Post
Next Post

Leave a Reply