[wxPython-users] Frame's child panel switching and frame sizes?

Robin Dunn robin at alldunn.com
Tue Jan 23 09:47:27 PST 2007


Basil Shubin wrote:
> Hi friends,
> 
> Here the next problem: I have frame with panel and want swap this panel 
> with other which I have created. I have destroy initial panel than 
> create new from other wx.Panel subclass and show it in the frame. 
> Moreover frame Min and Max size should be setted according each panels 
> size. In each panels subclasses I have add following code:
> 
> self.SetSizerAndFit(sizer)
> self.parent.SetInitialSize()
> size = self.parent.GetEffectiveMinSize()
> self.parent.SetMinSize(size)
> self.parent.SetMaxSize(size)
> self.Show(False)

Try something this instead:

self.SetSizerAndFit(sizer)
self.parent.Fit()
size = self.parent.GetSize()
self.parent.SetSizeHintsSz(size, size)


BTW, it would be *much* easier to test with your sample apps if they 
were in a single module.  If it takes me more than a minute or two to 
read and understand a sample then I tend to ignore it.  Plus, the act of 
actually rewriting your code into a small sample app will often help you 
to discover the solution yourself.

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





More information about the wxpython-users mailing list