(3rd try at sending this - hope it is the last!)
Hi all. I just discovered this behavior, which is making life rather
difficult: I have a sizer which contains a progress bar that I want
to display and hide multiple times within a panel. However, it's not
sufficient to just toggle the visibility of the item, because I really
want to be able to toggle the space around it as well.I was hoping to accomplish this using sizer.Prepend (osizer, 0, wxEXPAND)
and then use a sizer.Remove (osizer). This work great the first time and
then prompts the following:
[...]
The problem is that sizer.Remove(item) actually deletes item if it is a sizer. As a workaround, I usually do something like this (warning, the actual code shown is untested):
def remove_item(sizer, pos):
"""removes item at 'pos' in 'sizer'"""
item = sizer.GetChildren()[pos]
if item.IsSizer(): item.SetSizer(None)
sizer.Remove(pos)
i.e, before removing a sizer, be sure that it is not referenced by the corresponding wxSizerItem.
Hope that this helps.
Regards,
Alberto