Hi Werner,
What about just hiding the wx.StaticBox instance? The sizer can not be
hidden as it is never really shown.
Or do I understand you not correctly?
If you put the StaticBox etc on a Panel, then you should be able to hide
it all by 'just' hiding the panel.
Werner
The StaticBoxSizer (or *Stationmaster* as my spell checker want to call
it) draws a box around the controls inside it and optionally displays a
label, so I would like to hide these as well otherwise I am left with (in
my case) quite a large empty box.
self.stbz.Hide()
Traceback (most recent call last):
File "<string>", line 1, in <fragment>
TypeError: Hide() takes at least 2 arguments (1 given)
I assume the 1 argument is self, but what else is it expecting?
The item for which that sizer is managing the size. E.g.
self.stbz.Hide(panel5)
self.stbze.Layout() # or is it Layout() on the parent widget? I am not
sure/haven't tried it. I'd guess sizer in this case...?
Here's the docs text for sizer.Show(), for which sizer.Hide() is a
convenience method of, equal to Show(show=False):
Shows or hides an item managed by the sizer. To make a sizer item disappear
or reappear, use Show followed by Layout
<wxPython API Documentation — wxPython Phoenix 4.2.2 documentation. The *item*
parameter can be either a window, a sizer, or the zero-based index of the
item. Use the recursive parameter to show or hide an item in a subsizer.
Returns True if the item was found.
II was hoping to avoid the hassle of using panels but I'll do that if
necessary.
As I understand it, now for using StaticBox, you should make the StaticBox
the parent of the widgets shown within the box (it used to be, prior to
wxPython 2.9, you'd make the items shown in it siblings of the staticBox,
but not now). Then, if you call my_static_box.Hide(), it should, I think,
hide all the widgets within it... I'd at least try that, if you make sure
they are children of the static box.
Che
···
On Wed, Aug 6, 2014 at 12:37 PM, David Hughes <dfh@forestfield.co.uk> wrote:
On 06/08/2014 16:37, Werner wrote: