views:

449

answers:

1

Hi, I'm trying a simple layout and the panel divided by a SplitterWindow doesn't expand to fill the whole area, what I want is this:

[button]   <= (fixed size)
---------                            
TEXT AREA                            }
~~~~~~~~~  <= (this is the splitter) } this is a panel
TEXT AREA                            }

The actual code is:

 import wx
 app = wx.App()
 frame = wx.Frame(None, wx.ID_ANY, "Register Translator")

 parseButton = wx.Button(frame, label="Parse")
 panel = wx.Panel(frame)
 panel.SetBackgroundColour("BLUE")
 splitter = wx.SplitterWindow(panel)
 inputArea = wx.TextCtrl(splitter, style=wx.TE_MULTILINE)
 outputArea = wx.TextCtrl(splitter, style=wx.TE_MULTILINE)
 splitter.SplitHorizontally(inputArea, outputArea)

 sizer=wx.BoxSizer(wx.VERTICAL)
 sizer.Add(parseButton, 0, wx.ALIGN_CENTER)
 sizer.Add(panel, 1, wx.EXPAND | wx.ALL)

 frame.SetSizerAndFit(sizer)
 frame.SetAutoLayout(1)

 frame.Show(True)
 app.MainLoop()

I set the panel color different, and it's actually using the whole area, so the problem is just the SplitterWindow within the Panel, not within the BoxSizer.

Any ideas about why it isn't working? Thanks!

+3  A: 

The Panel is probably expanding but the ScrolledWindow within the Panel is not, because you aren't using a sizer for the panel, only the frame.

You could also try just having the SplitterWindow be a child of the frame, without the panel.

FogleBird
thanks, I've added a second sizer for the panel and added the splitter to it and it works... but I don't understand totally why it works in the Frame without needing a sizer :-s
fortran
If a frame has only one child, it will resize it to fill the frame in the EVT_SIZE callback.
FogleBird