After looking through your code (and it wasn't easy - please consider formatting it differently next time - maybe grouping the self.sizer.add
functions or something) I think I discovered your bug:
When you call Replace
on a sizer, the item being replaced is not destroyed but becomes no longer managed by the sizer. You need to hide or destroy the old window (the wx.StaticText
)
As mentioned in the wxWidgets docs:
virtual bool Replace (wxWindow *oldwin, wxWindow *newwin, bool recursive=false)
Detaches the given oldwin from the sizer and replaces it with the given newwin.
George Edison
2010-03-26 05:43:06