[wxPython-users] Changing content of a sizer

Werner F. Bruhin werner.bruhin at free.fr
Fri Aug 3 02:54:28 PDT 2007


Hi Norberto,

Norberto Lopes wrote:
> Thanks for the quick answer.
>
> At Thu, 02 Aug 2007 18:21:35 +0200,
> "Werner F. Bruhin" <werner.bruhin at free.fr> wrote:
>   
>> Norberto Lopes wrote:
>>     
>>> Can someone give me some insight as to how to change the contents of a
>>> Sizer?
>>> I have a pane, which has two sizers. I want to change the content of
>>> one of its sizers dinamically.
>>>   
>>>       
>> Have a look at the gridbagsizer demo, it does hide/show of items.
>>     
> In gridbagsizerdemo, they just hide things.
> I don't want that. I want to actually change the contents of a sizer
> for something else. Or maybe just change one sizer for another (this
> solution I think may be easier).
>   
You would then just extend on this, i.e. use things like 
sizer.Replace(oldwin, newwin), or sizer.Detach and sizer.Insert etc.

Depending on your needs you can just destroy the oldwin or you hide it 
and then it again.

After you change the sizer content you will probably have to call 
sizer.Layout() to force it to lay things out correctly based on the new 
content.

Maybe build a small sample and if things still don't work for you then 
post the sample here.

Werner




More information about the wxpython-users mailing list