ListCtrl: Resize on item addition without showing vertical scrollbar if space exists in parent.

Aniruddha Apte aniapte at gmail.com
Thu Nov 30 03:07:37 PST 2006


Hi,

I have a window with a vertical box sizer with many items. The last
item is a ListCtrl to which items will be added dynamically. I've
added the list to the sizer this way:
self.mainSizer.Add(self.list, proportion=0, flag=wx.EXPAND)

This keeps the height of the list constant even when there is space
remaining in the parent window for the list to expand into. However I
don't want the list occupying the whole remaining space if it doesnt
have that many items.

How can I make the ListCtrl to be resized on item addition so that its
height is sufficient to show all the rows without showing a vertical
scrollbar unless necessary.

Many thanks in advance.

PS: Please CC me since I am not subscribed to the list.

regards,
anir




More information about the wxpython-users mailing list