ghost654
ghost654

Reputation: 171

Pyside - QGridLayout addStretch option?

I have a layout that I need the widgets pushed upwards. I know I can do this

layout = QtWidgets.QVBoxLayout()
layout.addWidget(test_widget)
layout.addStretch()

and the addStretch will push all widgets to the top. However the layout that I am using is a QGridLayout and .addSretch() does not work with the grid layout. How would I fill in all the empty space at the bottom of my window and push all my widgets to the top with a grid layout?

Upvotes: 4

Views: 3533

Answers (1)

ghost654
ghost654

Reputation: 171

nevermind, I found the answer. I had to to do this

layout.setRowStretch(row_number, 1)

Upvotes: 5

Related Questions