Like FourWaySplitter but different
Question: Using Python 2.6, wx.Python:

Wonder if someone might know how to build a four panel window w/o using
FourWaySplitter. (Unless I am wrong FourWaySplitter will do what I am about to
describe. With FourWaySplitter any change of the size of any sub-panel changes
the size of ALL sub-panels.)

Here is what I need:

ONE vertical split and two **INDEPENDENT** horizontal splits one on each of
the newly split vertical parts. (sounds simple but after a day of trying every
permentation of splitters and sizers, I have finally admitted defeat.)

Anyway the idea is that only the vertical splitter would change the size of
all four windows. The horizontal splitter on the left side of the vertical one
would change only the two windows/panels on the left of the vertical splitter,
and the horizontal splitter splitter on the right of the vertical splitter
would change only the two windows/panels on the right of the vertical
splitter.

A concrete working example would be a lot of help and greatly appreciated and
if you come to my house I will make you some pancakes.


Answer: This was pretty confusing for me too. Fortunately, I wanted to write an
article on the subject and I finally figured it out after a couple of hours a
month or three ago. I still haven't written the article, but I paired down my
example a little for this answer. Hopefully you can follow it:

    
    
    import random
    import wx
    
    ########################################################################
    class RandomPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
            color = random.choice(["red", "green", "blue", "yellow"])
            self.SetBackgroundColour(color)               
    
    ########################################################################
    class MainPanel(wx.Panel):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self, parent):
            """Constructor"""
            wx.Panel.__init__(self, parent)
    
            # create the sizers
            sizer = wx.BoxSizer(wx.VERTICAL)
            twoSplitSizer = wx.BoxSizer(wx.HORIZONTAL)
            verticalSplitter = wx.SplitterWindow(self)
    
            # create the left side
            leftSplitter = wx.SplitterWindow(verticalSplitter)
            panelOne = RandomPanel(leftSplitter)
            panelTwo = RandomPanel(leftSplitter)
            leftSplitter.SplitHorizontally(panelOne, panelTwo)
            leftSplitter.SetSashGravity(0.5)
    
            # create the remote side
            rightSplitter = wx.SplitterWindow(verticalSplitter)
            panelThree = RandomPanel(rightSplitter)
            panelFour = RandomPanel(rightSplitter)
            rightSplitter.SplitHorizontally(panelThree, panelFour)
            rightSplitter.SetSashGravity(0.5)
    
            verticalSplitter.SplitVertically(leftSplitter, rightSplitter)
            verticalSplitter.SetSashGravity(0.5)
    
            sizer.Add(verticalSplitter, 1, wx.EXPAND)
            self.SetSizer(sizer)
    
    ########################################################################
    class MainFrame(wx.Frame):
        """"""
    
        #----------------------------------------------------------------------
        def __init__(self):
            """Constructor"""
            wx.Frame.__init__(self, None, title="4-Way Split", size=(800,600))
            panel = MainPanel(self)
            self.Show()
    
    
    #----------------------------------------------------------------------
    if __name__ == "__main__":
        app = wx.App(False)
        frame = MainFrame()
        app.MainLoop()
    

I use the random colors just to make it easier to distinguish between panels.
Normally, you'd have different widgets on each panel. Anyway, this works for
me on Windows with wxPython 2.8.11

