How to use wx.adv.SashLayoutWindow...

I have a window (subclass of wx.Frame).

I have 3 panels (each a subclass of wx.Panel).

I want to lay out the 3 panels using SashWindows (or SashLayoutWindows, not sure of the difference) like this:

···

±—±—±—+

…|…|…|
.P1.|.P2.|.P3.|
…|…|…|
±—±—±—+

I want P1 to be as narrow as its widgets allow and P2 and P3 to be the same width as each other and as wide as possible.

And if the user resizes the window I want the extra horizontal space going to P2 and P3 equally.

I’ve made a panel child of my wx.Frame:

self.panel = wx.Panel(self)
And I’ve created 3 sash windows using:

def make_sash(self):
sash = wx.adv.SashLayoutWindow(self.panel, style=wx.adv.SW_3D)
sash.Alignment = wx.adv.LAYOUT_LEFT
sash.Orientation = wx.adv.LAYOUT_VERTICAL
sash.SetSashVisible(wx.adv.SASH_RIGHT, True)
sash.SetExtraBorderSize(BORDER)
return sash
And I’ve created each panel (P1, P2, P3) as a child of its sash.

At the moment the panels are just placeholders, e.g.,

class Panel(wx.Panel):

def __init__(self, *args, **kwargs):
    super().__init__(*args, **kwargs)
    placeholder = wx.StaticText(self, label='ControlPanel')
    sizer = wx.BoxSizer()
    sizer.Add(placeholder, 1, wx.EXPAND)
    sizer.Fit(self)

Can anyone advise me?

I’ve now switched to using wx.SplitterWindow, where P1 is one part and another splitter containing P2 and P3 is the other.

It basically works (everything appears); just got to figure out how to get the proportions etc. working.

Take a look at wx.lib.splitter, it allows multiple splits in the same container.

···

On Thursday, April 18, 2019 at 7:31:55 AM UTC-7, Mark wrote:

I’ve now switched to using wx.SplitterWindow, where P1 is one part and another splitter containing P2 and P3 is the other.

It basically works (everything appears); just got to figure out how to get the proportions etc. working.

Robin

Thanks, I’ll give it a try.

···

On Thursday, 18 April 2019 17:00:40 UTC+1, Robin Dunn wrote:

On Thursday, April 18, 2019 at 7:31:55 AM UTC-7, Mark wrote:

I’ve now switched to using wx.SplitterWindow, where P1 is one part and another splitter containing P2 and P3 is the other.

It basically works (everything appears); just got to figure out how to get the proportions etc. working.

Take a look at wx.lib.splitter, it allows multiple splits in the same container.

Robin