pyqt5 change table widget column width

Solutions on MaxInterview for pyqt5 change table widget column width by the best coders in the world

showing results for - "pyqt5 change table widget column width"
Lennart
07 Sep 2016
1header = self.table.horizontalHeader()       
2header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
3header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
4header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
5#the first column will stretch to fill the window and the others will resize 
6#to the contents. If you want them to be equally sized change all resize modes
7#to QtWidgets.QHeaderView.Stretch