Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top