Hiding a panel in sizer

There is MainPanel.
MainPanel contains three panels: PanelA, PanelB & PanelC in a
horizontal sizer name "mainHSizer".

PanelA, PanelB & PanelC has widgets in it with their own sizer.

In mainPanel at any point in time there is only ONE panel is visible
out of three panels (A, B & C).
This is conditional

    def manageWidgets(self):
        """"""
        if condition1:
            self.PanelA.Show(True)
            self.PanelB.Show(False)
            self.PanelC.Show(False)
        elif conditio2:
            self.PanelA.Show(False)
            self.PanelB.Show(True)
            self.PanelC.Show(False)
        else:
            self.PanelA.Show(False)
            self.PanelB.Show(False)
            self.PanelC.Show(True)

        self.SetSizerAndFit(self.mainHSizer)

The problem is that all the panels are visible and Show(False) is not
doing anything?

Prashant
Python 2.6.2
wxPython 2.8.10.1
XP 32

Hi,
I guess, you can try something like

mainHSizer.Show(PanelA, show=True, recursive=True)

the "recursive" parameter is probably not needed here, as the panels
are directly contained in the sizer and not in some deeper nesting.

hth
  Vlasta

···

2009/12/31 King <animator333@gmail.com>:

There is MainPanel.
MainPanel contains three panels: PanelA, PanelB & PanelC in a
horizontal sizer name "mainHSizer".

PanelA, PanelB & PanelC has widgets in it with their own sizer.

In mainPanel at any point in time there is only ONE panel is visible
out of three panels (A, B & C).
This is conditional

def manageWidgets(self):
""""""
if condition1:
self.PanelA.Show(True)
self.PanelB.Show(False)
self.PanelC.Show(False)
elif conditio2:
self.PanelA.Show(False)
self.PanelB.Show(True)
self.PanelC.Show(False)
else:
self.PanelA.Show(False)
self.PanelB.Show(False)
self.PanelC.Show(True)

   self\.SetSizerAndFit\(self\.mainHSizer\)

The problem is that all the panels are visible and Show(False) is not
doing anything?

Prashant
Python 2.6.2
wxPython 2.8.10.1
XP 32

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

There is MainPanel.
MainPanel contains three panels: PanelA, PanelB& PanelC in a
horizontal sizer name "mainHSizer".

PanelA, PanelB& PanelC has widgets in it with their own sizer.

In mainPanel at any point in time there is only ONE panel is visible
out of three panels (A, B& C).
This is conditional

     def manageWidgets(self):
         """"""
         if condition1:
             self.PanelA.Show(True)
             self.PanelB.Show(False)
             self.PanelC.Show(False)
         elif conditio2:
             self.PanelA.Show(False)
             self.PanelB.Show(True)
             self.PanelC.Show(False)
         else:
             self.PanelA.Show(False)
             self.PanelB.Show(False)
             self.PanelC.Show(True)

         self.SetSizerAndFit(self.mainHSizer)

If self already has this sizer set then don't do SetSizerAndFit again. It may be destroying the existing sizer (which is the same one) and then setting a now dead/bogus pointer to be the new sizer. Just do a self.Layout() and if you also want self to also adjust its own size then do a self.Fit()

The problem is that all the panels are visible and Show(False) is not
doing anything?

It should be. Perhaps something else is interfering with it.

Do you have content on the panels that you can still see, or is it that you can see the empty space that is not being hidden? If so then it may just be because you are killing the sizer as described above.

···

On 12/31/09 1:36 AM, King wrote:

--
Robin Dunn
Software Craftsman