[wxPython] wxBoxSizer not working as expected

I want the Notebook to fill all of the extra vertical space above it in the
Panel. Instead is is splitting the extra space with ... something (the
search field sizer?). Anyone have any ideas?

thanks
greg

from wxPython.wx import *

class MyApp(wxApp):
    def OnInit(self):
        frame = wxFrame(NULL, -1, "MyApp", (450, 350))

        splitter = wxSplitterWindow(frame, -1)
        p1 = ScriptsPanel(splitter)
        p2 = ScriptsPanel(splitter)
        splitter.SplitVertically(p1, p2)
        splitter.SetSashPosition(75)

        frame.Show(true)
        self.SetTopWindow(frame)

        return true

class Panel(wxPanel):
    def __init__(self, parent):
        wxPanel.__init__(self, parent, -1)

        self.sizer = wxBoxSizer(wxVERTICAL)
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)

        self.titleCtrl = wxButton(self, -1, label='Title')
        self.titleCtrl.Enable(FALSE)
        self.add(self.titleCtrl, stretch=0, expand=1)

    def add(self, control, stretch=0, expand=0):
        if expand:
            expand = wxEXPAND
        self.sizer.Add(control, stretch, expand)

    def theme(self, foreground=None, background=None, title=None):
        if foreground:
            self.titleCtrl.SetForegroundColour(foreground)
        if background:
            self.titleCtrl.SetBackgroundColour(background)
        if title:
            self.titleCtrl.SetLabel(title)

class ScriptsPanel(Panel):
    def __init__(self, parent):
        Panel.__init__(self, parent)
        self.theme(title='My Panel')

        searchPanel = wxPanel(self, -1)
        self.add(searchPanel, stretch=1, expand=1)

        searchSizer = wxBoxSizer(wxHORIZONTAL)

        self.criteria = wxTextCtrl(searchPanel, -1)
        searchSizer.Add(self.criteria, 1, wxALL, border=4)

        self.search = wxButton(searchPanel, -1, label='Search')
        searchSizer.Add(self.search, 0, wxALL, border=4)

        searchPanel.SetSizer(searchSizer)
        searchPanel.SetAutoLayout(1)

        self.scriptNotebook = wxNotebook(self, -1)
        self.add(self.scriptNotebook, stretch=1, expand=1)

        self.scriptNotebook.AddPage(wxButton(self.scriptNotebook, -1,
label='This is a test!'), "Test")

app = MyApp(0)
app.MainLoop()

I want the Notebook to fill all of the extra vertical space above it in the
Panel. Instead is is splitting the extra space with ... something (the
search field sizer?). Anyone have any ideas?

[...]

class ScriptsPanel(Panel):
    def __init__(self, parent):
        Panel.__init__(self, parent)
        self.theme(title='My Panel')

        searchPanel = wxPanel(self, -1)

          # self.add(searchPanel, stretch=1, expand=1) call this later
         

        searchSizer = wxBoxSizer(wxHORIZONTAL)

        self.criteria = wxTextCtrl(searchPanel, -1)
        searchSizer.Add(self.criteria, 1, wxALL, border=4)

        self.search = wxButton(searchPanel, -1, label='Search')
        searchSizer.Add(self.search, 0, wxALL, border=4)

        searchPanel.SetSizer(searchSizer)
        searchPanel.SetAutoLayout(1)

          # set the optimal size for the sub-panel
          searchSizer.Fit(searchPanel)

          # now add the sub-panel to the main sizer, but with stretch==0
          # otherwise it will always have the same size as the notebook
          self.add(searchPanel, stretch=0, expand=1)

        self.scriptNotebook = wxNotebook(self, -1)
        self.add(self.scriptNotebook, stretch=1, expand=1)

        self.scriptNotebook.AddPage(wxButton(self.scriptNotebook, -1,
label='This is a test!'), "Test")

[...]

Bye,
Alberto

···

On Sun, 11 Aug 2002 17:43:05 -0500 "Greg Krohn" <gkrohn@volucris.8m.com> wrote: