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

Discussion in 'Python' started by F. GEIGER, Oct 29, 2004.

  1. F. GEIGER

    F. GEIGER Guest

    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.

    For now I issue a dialog telling the user, that he has to restart the app -
    not very professional looking...

    So, how is this done best?

    Kind regards
    Franz GEIGER
    F. GEIGER, Oct 29, 2004
    #1
    1. Advertising

  2. F. GEIGER

    Cliff Wells Guest

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

    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.

    Regards,
    Cliff

    --
    Cliff Wells <>
    Cliff Wells, Oct 29, 2004
    #2
    1. Advertising

  3. F. GEIGER

    F. GEIGER Guest

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

    "Cliff Wells" <> schrieb im Newsbeitrag
    news:...
    > 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 <>
    >
    F. GEIGER, Oct 29, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mortb
    Replies:
    1
    Views:
    319
    William F. Robertson, Jr.
    Feb 10, 2005
  2. Eduardo Bernal
    Replies:
    2
    Views:
    280
    Bob Ippolito
    Mar 5, 2004
  3. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Have a page fully rebuild

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Jan 17, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    310
    Walter Wang [MSFT]
    Jan 17, 2007
  4. AAaron123
    Replies:
    2
    Views:
    283
    AAaron123
    Aug 10, 2009
  5. Chumley the Walrus
    Replies:
    2
    Views:
    236
    Tom Gosselin
    Aug 10, 2004
Loading...

Share This Page