I want to remove a panel from a sizer, but it doesn't get cleaned up
properly. I have a sizer that I want to dynamically add and remove panels
from:
class MyBigPanel(wxPanel):
[...]
def AddPanel(self, myid):
panel = MyInsidePanel(self, -1, myid)
self.panel_sizer.Add(panel, 0, wxEXPAND | wxALIGN_CENTRE | wxALL, 0)
self.mypanels[myid] = panel
self.GetSizer().Layout()
self.Refresh()
def RemovePanel(self, myid):
self.panel_sizer.Remove(self.mypanels[myid])
del self.mypanels[myid]
self.GetSizer().Layout()
self.Refresh()
[...]
The panel is added correctly and all seems fine there. If I remove a panel
(via RemovePanel()) it gets cleaned up correctly, except when I try to
remove the bottom panel in the sizer (i.e. the last one). Then it isn't
cleaned up at all and all things inside the panel are drawn but doesn't
follow the sizer rules anymore. I use python 2.3.3 and wxPython 2.4.2.4
for Gtk+. Is this a known wxPython bug? What can I do to avoid this
behaviour?
/Ragnar