2

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!

asked Jun 26, 2009 at 13:15

1 Answer 1

3

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.

answered Jun 26, 2009 at 13:35
Sign up to request clarification or add additional context in comments.

2 Comments

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
If a frame has only one child, it will resize it to fill the frame in the EVT_SIZE callback.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.