import PySide2.QtWidgets as QtWidgets # Create a QVBoxLayout and add widgets to it layout = QtWidgets.QVBoxLayout() layout.addWidget(QtWidgets.QLabel("Widget 1")) layout.addWidget(QtWidgets.QLabel("Widget 2")) # Add a stretchable space to the layout layout.addStretch() # Add another widget to the layout layout.addWidget(QtWidgets.QLabel("Widget 3"))
import PySide2.QtWidgets as QtWidgets # Create a QVBoxLayout layout = QtWidgets.QVBoxLayout() # Add a widget and stretchable space to the layout layout.addWidget(QtWidgets.QLabel("Widget 1")) layout.addStretch() # Add two more widgets to the layout layout.addWidget(QtWidgets.QLabel("Widget 2")) layout.addWidget(QtWidgets.QLabel("Widget 3"))In this example, we create a QVBoxLayout and add one QLabel widget to it. We then call addStretch to add a stretchable space to the layout, which pushes the remaining widgets to the bottom. Finally, we add two more QLabel widgets to the bottom of the layout. Package Library: PySide2