QHBoxLayout
The QHBoxLayout
class lines up widgets horizontally. If the widgets do not fit
in the window, the layout will automatically wrap or resize them. For a vertical
layout, use QVBoxLayout
.
Methods
Examples
layout = QtWidgets.QHBoxLayout()
layout.addWidget(QPushButton("Button 1"))
layout.addWidget(QPushButton("Button 2"))
addWidget
method from the parent QLayout
parent class. The buttons will be aligned horizontally.
addLayout(layout)
Adds a layout to the horizontal box layout. The layout will be added to the right of the existing layouts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layout |
QLayout
|
the layout to add. |
required |