WxPython SplitterWindow not expanding inside panel

I am trying to create a simple layout, and the panel divided by SplitterWindow does not expand to fill the entire area that I want:

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

Actual code:

    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 color of the panel to different, and in fact it uses the entire area, so the problem is only in the SplitterWindow inside the Panel, and not in BoxSizer.

Any ideas on why it is not working? Thanks!

+3
source share
1 answer

The panel is probably expanding, but the ScrolledWindow inside the Panel does not work, because you are not using sizer for the panel, only the frame.

You can also try to make SplitterWindow a child of a frame without a panel.

+4

Source: https://habr.com/ru/post/1711342/


All Articles