gizmos.TreeCtrl question
Stefano Bartaletti
s.bartaletti at dyemagic.com
Mon Feb 25 09:13:06 PST 2008
Hello,
I am using a TreeListCtrl (as in the demo for TreeMixin) with 4 columns.
I want to resize the column labels with proportional values (like a Sizer
does), so I wrote this function called in an OnSize event:
def adjustColumns(self):
props = (5,1,1,1)
totProps = reduce(operator.add, props)
maxSize = self.GetMainWindow().GetClientSize().x
totSize = 0
for idx, prop in enumerate(props):
newSize = (maxSize * prop) / totProps
self.SetColumnWidth(idx, newSize)
totSize += newSize
# Last column should get any spare size
self.SetColumnWidth(idx, newSize + (maxSize - totSize))
It works fine except that the rightest Column is overlapped by a Scrollbar if
I start with a small list and then expand one or more items, so I tried
forcing a CallAfter to this function in an OnExpandItem
The call to self.GetMainWindow().GetClientSize() always gives me the size of
the ScrolledWindow inside the Tree withouth taking Scrollbars into its
calculation
I have tried forcing Refresh/Layout on the Tree window and on the
GetMainWindow() object before GetClientSize() with no luck.
How do I get the correct result? Is there any special event I should handle or
am I using data from the wrong Window?
Thanks for any tip
--
Cordialmente
Stefano Bartaletti
Responsabile Software
G.Tosi Spa Tintoria
Skype account: stefano.bartaletti
ICQ contact : 1271960
Viale dell'Industria 61
21052 Busto Arsizio (VA)
Tel. +39 0331 34 48 11
Fax +39 0331 35 21 23
More information about the wxpython-users
mailing list