[wxPython-users] Change contents of a window...

Phil Mayes phil at philmayes.com
Sat Nov 17 12:02:31 PST 2007


At 07:52 AM 11/17/2007, you wrote:
>I am wondering how I could change the contents (layout, controls, etc) of 
>a window when I click a button, kind of like the way MSN or aMSN does it. 
>Is there a way to do this? If so, how?

Yes, several ways.  In the button handler, you can call Show(boolean) for 
each of the controls to show/hide.  Cleaner, you can put them all in a 
sizer and Hide/Show the sizer.  If you want the layout of the window to 
change, as opposed to having blank space where the controls were visible, 
call Fit and Layout.

sizer = self.GetSizer()
sizer.Show(theSizerImHiding, False)
sizer.Fit(self)
self.Layout()





More information about the wxpython-users mailing list