If you want the columns to expand evenly, you can also set the resize mode
tableview.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
In pyqt5 is setResizeModeno longer available. Instead, use setSectionResizeModeand QHeaderViewin the module QtWidgets.
source
share