grid_layout = QGridLayout() grid_layout.setRowStretch(0, 3) grid_layout.setRowStretch(1, 1)
grid_layout = QGridLayout() for i in range(NUM_ROWS): grid_layout.setRowStretch(i, 1)In this example, all rows will have the same stretch factor, which means they will all grow or shrink in size at the same rate when the parent widget is resized. The package library used in these examples is PyQt5.Qt.