[wxPython] wxNotebook: GetSizer() always returns None

It seems that GetSizer always returns None
for a wxNotebook, even if the notebook has
a sizer. Run the code below for an example.
(Note that this only works with the recent
fix for GetSizer() in windows.py. I.e.,
insert "from sizers import wxSizerPtr"
after line 484.) Is this because notebook
sizers are special? Could this be changed?

I am trying to do recursive SetItemMinSize()
by way of win.GetChildren() and win.GetSizer().
Unfortunately, an embedded notebook causes
the algorithm to fail.

Ralf

from wxPython.wx import *

class MyApp(wxApp):

  def OnInit(self):
    main_frame = wxFrame(NULL, -1, 'Main Frame', size = wxSize(400, 400))

    nb_win = wxNotebook(main_frame, -1)
    nb_szr = wxNotebookSizer(nb_win)
    nb_win.SetAutoLayout(true)

    subp_win = wxPanel(nb_win, -1)
    subp_szr = wxBoxSizer(wxVERTICAL)
    subp_win.SetAutoLayout(true)
    subp_win.SetSizer(subp_szr)

    btn = wxButton(subp_win, -1, 'Button')
    subp_szr.Add(btn, 0, wxALL, 10)
    subp_szr.Fit(subp_win)

    nb_win.AddPage(subp_win, 'Page 1')
    nb_szr.Fit(nb_win)

    print nb_win.GetSizer()
    print subp_win.GetSizer()
    
    main_frame.Show(true)
    self.SetTopWindow(main_frame)
    return true

app = MyApp(0)
app.MainLoop()

--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

It seems that GetSizer always returns None
for a wxNotebook, even if the notebook has
a sizer.

...

from wxPython.wx import *

class MyApp(wxApp):

  def OnInit(self):
    main_frame = wxFrame(NULL, -1, 'Main Frame', size = wxSize(400, 400))

    nb_win = wxNotebook(main_frame, -1)
    nb_szr = wxNotebookSizer(nb_win)
    nb_win.SetAutoLayout(true)

GetSizer returns None for the notebook because the notebook doesn't actually
have a sizer, because SetSizer isn't called. But as it says in the docs for
wxNotebookSizer you don't want to do that anyway. wxNotebookSizer is meant
to be nested inside another sizer and simply checks the sizers on all the
notebook pages and reports the max min size plus room for the notebook tabs
to the parent sizer.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com
http://wxpython.org Java give you jitters?
http://wxpros.com Relax with wxPython!