Problems with wxNotebook and sizers

Hi

I'm very new to wxWindows so I'm having a few problems getting sizers
to work properly. It is quite likely that I'm just trying to get them
to do something that they are not supposed to.

I am using wxPython to build an application in which I have a
wxNotebook inside a wxWindow (which in turn is inside another
wxWindow). I want to allow the user to manually resize the window with
the notebook in it. The trouble is that when the wxWindow containing
the notebook changes size the notebook does not. This is where I
believe sizers come in. I have a wxBoxSizer managing the notebook
inside the wxWindow. And I've even tried using wxNotebookSizer to keep
the notebook in check.

However, the notebook basically ignores my attempts to manage it with
the sizer. When the window changes size it does not. When I try to add
more than one item (wxToolbar, wxPanel, etc.) to the window they will
not place and size themselves as I thought they were supposed to.

Obviously I am a little confused and I think it's quite likely that I
am just misunderstanding the purpose of sizers. Can anyone clear this
up for me. Or does anyone know how to make the contents of this
wxWindow respond and be managed by the sizer.

Much thanks

Stephen Emslie

···

_______________________________________________________________________
LOOK GOOD, FEEL GOOD - WWW.HEALTHIEST.CO.ZA

Cool Connection, Cool Price, Internet Access for R59 monthly @ WebMail
http://www.webmail.co.za/dialup/

Stephen Emslie wrote:

Hi

I'm very new to wxWindows so I'm having a few problems getting sizers
to work properly. It is quite likely that I'm just trying to get them
to do something that they are not supposed to.

I am using wxPython to build an application in which I have a
wxNotebook inside a wxWindow (which in turn is inside another
wxWindow). I want to allow the user to manually resize the window with
the notebook in it. The trouble is that when the wxWindow containing
the notebook changes size the notebook does not. This is where I
believe sizers come in. I have a wxBoxSizer managing the notebook
inside the wxWindow. And I've even tried using wxNotebookSizer to keep
the notebook in check.

However, the notebook basically ignores my attempts to manage it with
the sizer. When the window changes size it does not. When I try to add
more than one item (wxToolbar, wxPanel, etc.) to the window they will
not place and size themselves as I thought they were supposed to.

If you are trying to SetSizer on a wxWindow (not a panel or some other derived class) then you will see this behaviour. The reason is the since wxWindow is the base class for all windows, and since not all of them should have AutoLayout capabilities then it is disbaled by default in wxWindow. It is easy to fix, either just use a wxPanel instead of a wxWindow, or give your wxWindow an EVT_SIZE handler and call self.Layout() from there.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!