how to make panel fit listctrl size?

Hi all,

I’m wondering how to make my panel fit to my listctrl (with dynamic data input) size. I use wx.EXPAND for my BoxSizer. Please see the attached code. Thanks!

post.py (2.44 KB)

Give the frame a sizer too and assign the panel to it. Then call the frame's Fit() method. That will resize the frame to be big enough to make the panel big enough to contain the best size of the listctrl.

···

yuming.cao@cyaninc.com wrote:

Hi all,

I'm wondering how to make my panel fit to my listctrl (with dynamic data
input) size.I use wx.EXPAND for my BoxSizer. Please see the attached
code. Thanks!

--
Robin Dunn
Software Craftsman

I tried, but it seems that the best size of the listctrl is much small than I expected, since my listctrl data is changing everytime, how can I resize according to the number of my row & column?

···

On Friday, March 8, 2013 7:22:35 PM UTC-8, Robin Dunn wrote:

yumin...@cyaninc.com wrote:

Hi all,

I’m wondering how to make my panel fit to my listctrl (with dynamic data

input) size.I use wx.EXPAND for my BoxSizer. Please see the attached

code. Thanks!

Give the frame a sizer too and assign the panel to it. Then call the
frame’s Fit() method. That will resize the frame to be big enough to
make the panel big enough to contain the best size of the listctrl.


Robin Dunn

Software Craftsman

http://wxPython.org

You can get the column widths and add them up to get the needed width. Row heights will be more tricky though, since the amount of space is dependent on font size and on some spacing, and that varies across platforms.

···

yuming.cao@cyaninc.com wrote:

I tried, but it seems that the best size of the listctrl is much small
than I expected, since my listctrl data is changing everytime, how can I
resize according to the number of my row & column?

--
Robin Dunn
Software Craftsman