Wxpython. Is it possible to change layout in a running application? Selfmade listbox

Hi,

Id like to make my own special listbox… I want to able (at the push of a button) to add another item to my special listbox… each item is a panel with a label, some buttons and maybe a text control.

I’ve tried adding a new panel object with the stuff i want to the sizer i’m using for my listbox (which is a panel which can contain other panels)… and then run update() and refresh() on everything… But it doesn’t work… i see a panel appearing, but it’s just a small square in the corner of my “listbox” panel, and it only works the first time… nothing new appears when I push the button again.

Is it at all possible to do this? Has anyone created something similar? Does anyone know what i’m doing wrong?

Thanks,
Soren

Søren Nielsen wrote:

Thanks Robin, the Layout call fixed the problem! I have another problem now though.. I'm using a scrolled.ScrolledPanel (scrolled = wx.lib.scrolledpanel), as the underlying panel where my new "listbox item" panels are located.. The scrollbar doesn't appear though when the number of new panels are too big for the underlying panel, even if I call the Layout(), but when I resize the window, it appears. Is scrolled.ScrolledPanel a special case?

You'll want to reset the virtual size to be the new size reported by the top level sizer. Something like self.SetVirtualSize(self.GetBestVirtualSize())

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Perfect. Thanks again Robin!

Soren

···

On Tue, Apr 8, 2008 at 3:43 AM, Robin Dunn robin@alldunn.com wrote:

Søren Nielsen wrote:

Thanks Robin, the Layout call fixed the problem! I have another problem now though… I’m using a scrolled.ScrolledPanel (scrolled = wx.lib.scrolledpanel), as the underlying panel where my new “listbox item” panels are located… The scrollbar doesn’t appear though when the number of new panels are too big for the underlying panel, even if I call the Layout(), but when I resize the window, it appears. Is scrolled.ScrolledPanel a special case?

You’ll want to reset the virtual size to be the new size reported by the top level sizer. Something like self.SetVirtualSize(self.GetBestVirtualSize())

Robin Dunn

Software Craftsman

http://wxPython.org Java give you jitters? Relax with wxPython!


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users