Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pyqt5 change table widget column width

header = self.table.horizontalHeader()       
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
header.setSectionResizeMode(1, QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(2, QtWidgets.QHeaderView.ResizeToContents)
#the first column will stretch to fill the window and the others will resize 
#to the contents. If you want them to be equally sized change all resize modes
#to QtWidgets.QHeaderView.Stretch
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #change #table #widget #column #width
ADD COMMENT
Topic
Name
9+5 =