def UpdateColWidth(self):
width, height = self.GetSizeTuple()
for i in xrange(self.GetNumberCols()):
colwidth = self.colratio[i] * width
self.SetColSize(i, colwidth)
colratio is a list of column ratios, say [0.4, 0.3, 0.3] for a 3 column
grid.
This function works, but only for grid cells, not the column labels.
If I maximums the window and calls UpdateColWidth, the cells expand to
proper width, but the column labels' width stay unchanged.
However, I noticed, if I minimizes/restores the window, the column label's
width will be updated.
Or if I switch to other window to overlap the grid, then the overlapped area
of the column label will be redrawn.
What's event for minimize/restore or overlap window? Can I use that event?
Anyway, back to my problem, how to change column width when the window is
resized?
Thanks
Leo
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Resize-wx-grid-column-width-tp4548847p4548847.html
Sent from the wxPython-users mailing list archive at Nabble.com.
SetColWidth() does not refresh the grid. You have to call ForceRefresh() to
see the changes.
http://docs.wxwidgets.org/2.8/wx_wxgrid.html#wxgridsetcolsize
cheers
--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Resize-wx-grid-column-width-tp4548847p4548869.html