Skip to content

QGroupBox


QGroupBox is a widget that groups other widgets together. It provides a title and a frame around the widgets it contains.

Parameters:

Name Type Description Default
title str

The title of the group box.

None

Signals

  • clicked: Emitted when the group box is clicked.

Methods


Examples


group_box = QtWidgets.QGroupBox("Group Box")
layout = QtWidgets.QVBoxLayout()
layout.addWidget(QPushButton("Button 1"))
layout.addWidget(QPushButton("Button 2"))

group_box.setLayout(layout)
Running the above code will create a group box with the title "Group Box" and two buttons aligned vertically inside it. Note that the layout is set using the setLayout method from the parent QWidget class.


setTitle(title)

Set the title of the group box.

Parameters:

Name Type Description Default
title str

The title of the group box.

required


title()

Get the title of the group box.

Returns:

Name Type Description
str str

The title of the group box.