[wxPython] wxNotebook in a wxWindow won't stretch

hello.

I am lost. After few hours of trying to solve it, I give up...

I have following piece of code (modified, shortened...):

class MainWindow(wxFrame):

    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title, size = (800, 600),
                         style=wxDEFAULT_FRAME_STYLE|
       wxNO_FULL_REPAINT_ON_RESIZE)

        self.CreateStatusBar(1, wxST_SIZEGRIP)

  # is ksSPLIT is set, we split main window horizontally into two
  # subwindows
  if ksSPLIT:
      self.splitter = wxSplitterWindow(self, -1, style=wxNO_3D|wxSP_3D)
      self.leftWin = self.splitter
      self.desktopFrame = wxWindow(self.splitter, -1)
      self.desktopFrame.SetBackgroundColour(wxNamedColour("Pink"))
  else:
      self.splitter = None
      self.leftWin = None
      self.desktopFrame = self

  # the following code won't reside in constructor later!
  # I need the desktopWin placed IN desktopFrame so that it occupies the
  # whole area of it
  # desktopWin may look differently depending on the application,
  # when no desktopWin is set up, desktopFrame should be visible
  
  self.desktopWin = wxNotebook(self.desktopFrame, -1)
  txt = wxTextCtrl(self.desktopWin, -1,
       style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
  self.desktopWin.AddPage(txt, "Overview")

  sizer = wxBoxSizer(wxHORIZONTAL)
  sizer.Add(self.desktopWin, 1, wxEXPAND | wxALIGN_CENTER, 5)
  self.desktopFrame.SetAutoLayout(true);
  self.desktopFrame.SetSizer(sizer);
  #sizer.Fit(self.desktopFrame)

        self.Show(true)

  if ksSPLIT:
      self.splitter.SplitVertically(self.leftWin, self.desktopFrame)
      self.splitter.SetSashPosition(180, true)
      self.splitter.SetMinimumPaneSize(20)

  # a jeste pocatecni formular a jeho pracovni podminky
  self.aktivniFormular = None
  self.desktopWin = None

now, when I set ksSPLIT = 0, everything works just fine. the desktopWin
occupies the whole area of desktopFrame (== self). but as soon as I change
ksSPLIT = 1, desktopWin takes only a very small area of desktopFrame (about
10x10 pixels) and it won't scale with the desktopFrame.

thanks for your help.
Jan

···

--
  Jan Fedak talk:jack@tornado.sh.cvut.cz
  mailto:J.Fedak@sh.cvut.cz mailto:jack@mobil.cz
                Linux - the ultimate NT Service Pack.

but as soon as I change
ksSPLIT = 1, desktopWin takes only a very small area of desktopFrame

(about

10x10 pixels) and it won't scale with the desktopFrame.

The wxWindow that you use for desktopFrame ignores auto layout, and so it
doesn't automatically evaluate the sizer. If you change it to a wxPanel it
does. (After fixing the other bug of giving the splitter to itself in
SplitVertically().)

···

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