Toolbox is a container. It can show groups of items separated by tabs. If there are to many items for a toolbar, you may want a toolbox.

A screenshot of a toolbox QToolBox is shown below.

toolbox pyqt qtoolbox

Download Examples:
Download PyQt examples

Toolbox example

QToolBox

The code below creates a toolbox with 3 items. The toolbox QToolBox has a method .addItem().

The toolbox itself has to be added to a layout, for instance layout.addWidget(toolbox, 0, 0).

from PyQt5.QtWidgets import *
import sys

class Window(QWidget):

def __init__(self):
QWidget.__init__(self)
layout = QGridLayout()
self.setLayout(layout)

# Add toolbar and items
toolbox = QToolBox()
layout.addWidget(toolbox, 0, 0)
label = QLabel()
toolbox.addItem(label, "Students")
label = QLabel()
toolbox.addItem(label, "Teachers")
label = QLabel()
toolbox.addItem(label, "Directors")

app = QApplication(sys.argv)
screen = Window()
screen.show()
sys.exit(app.exec_())