Layout question: make ScrolledWindow fill into a SplitterWindow

Hello,

i try to layout a window into a left and a right part with a
SplitterWindow.
Into both parts i'd like to place two ScrolledWindows that scroll two
Panels at the moment.
There will be different windows later, but for the moment two Panels
are fine.

Whatever i do, the ScrolledWindows don't fill the parts of the
SplitterWindow.

Can anybody give me a hint why?

Thanks for any hints,
Torsten.

Here's the script:

#! /usr/bin/python

import wx

from area2d import *

class AFrame(wx.Frame):
    def __init__(self, app, parent, id, title):
        self.app = app

        self.f = wx.Frame(parent, id, title)

        self.sw = wx.SplitterWindow(self.f, id)

        self.scl = wx.ScrolledWindow(self.sw, id)
        self.scr = wx.ScrolledWindow(self.sw, id)

        self.scl.SetMinSize(wx.Size(320, 600))
        self.scr.SetMinSize(wx.Size(640, 480))

        self.scl.SetBackgroundColour(wx.GREEN)
        self.scr.SetBackgroundColour(wx.BLUE)

        self.t = wx.Panel(self.scl, id)
        self.t.SetMinSize(wx.Size(320, 600))
        self.t.SetBackgroundColour(wx.RED)
        self.t.FitInside()
        self.t.SetAutoLayout(True)

        self.p = wx.Panel(self.scr, id)
        self.p.SetMinSize(wx.Size(640, 480))
        self.p.SetBackgroundColour(wx.CYAN)
        self.p.SetAutoLayout(True)

# self.scl.SetClientSize(wx.Size(320, 600))
# self.scr.SetClientSize(wx.Size(640, 480))

        self.scl.SetSize(wx.Size(320, 600))
        self.scr.SetSize(wx.Size(640, 480))

        self.sw.SplitVertically(self.scl, self.scr, 0)

        self.scl.Layout()
        self.scr.Layout()
        self.sw.Layout()

        self.f.Show(True)
        self.f.Bind(wx.EVT_CLOSE, self.OnClose)

        self.app.SetTopWindow(self.f)

    def OnClose(self, par):
        self.f.Destroy()
        self.app.close()

class AApp(wx.App):
    def OnInit(self):
        wx.App.__init__(self)

        self.f = AFrame(self, None, -1, "An Editor")

        return True

    def close(self):
        self.ExitMainLoop()

a = AApp(0)
a.MainLoop()

You may need to use sizers;
try to add e.g. the following lines after self.t.SetAutoLayout(True)

       self.scl_sizer = wx.BoxSizer(wx.VERTICAL)
       self.scl_sizer.Add(self.t, 1, wx.EXPAND)
       self.scl.SetSizer(self.scl_sizer)

to see, if it is, what you need; (some parts of the previous code are
probably redundant).

You may check the sizers examples in the wxpython demo or the online docs.

hth
  vbr

···

2009/6/7 Torsten Mohr <tmohr@s.netic.de>:

Hello,

i try to layout a window into a left and a right part with a
SplitterWindow.
Into both parts i'd like to place two ScrolledWindows that scroll two
Panels at the moment.
There will be different windows later, but for the moment two Panels
are fine.

Whatever i do, the ScrolledWindows don't fill the parts of the
SplitterWindow.

Can anybody give me a hint why?

Thanks for any hints,
Torsten.
...