[wxPython] How to rebuild a page containing controls becausesome of them have to be deleted?

F. GEIGER f.geiger at vol.at
Fri Oct 29 21:30:05 CEST 2004


"Cliff Wells" <clifford.wells at comcast.net> schrieb im Newsbeitrag
news:mailman.5680.1099077017.5135.python-list at python.org...
> On Fri, 2004-10-29 at 20:51 +0200, F. GEIGER wrote:
> > I often use Notebook to structure my GUIs. Sometimes I have to provide a
> > Settings page. Doing changes in this page influences other pages in such
a
> > way, that some controls have to change add or remove children or even
have
> > to be removed from the page at all.
> >
> > Yet I could not come up with a solid pattern how to do this. I tried to
call
> > DestroyChildren(), delete all ref's to them, and to set the page's sizer
to
> > None. This doesn't work very well. When I rebuild the page, at least the
> > arrangement of the controls is not the same as before, which makes me
think,
> > that other things will go wrong in the long run too.
>
> I use this technique with little issue (although I haven't tried it with
> a wx.Notebook).  One thing you might try is to use an extra wx.Panel as
> a container for the entire page.  So each page then would end up with a
> single panel for the page, and each panel further containing *another*
> single panel which contains your actual controls.  This way you can
> simply destroy the second panel and recreate it and the layout is simple
> enough that you shouldn't run into problems with sizers getting
> confused.

I thought about an extra panel too, shouldn't be a problem with Notebook
either. So if this is how it is done, I'll go for it.

>
> Regards,
> Cliff
>

Many thanks for your quick reply!

Kind regards
Franz


> --
> Cliff Wells <clifford.wells at comcast.net>
>





More information about the Python-list mailing list