Splitting a splitter

Hi all, I have looked on the wiki and have done my best to figure this out,
but I can't get it right and I am running out of fistfuls of hair :slight_smile:

I want to have a splitter inside a splitter - I need an app split into there
vertical panels that can resize.

So, I have been working along this line (see below), can you help?

Thanks,
Donn.

import wx

class MySplitter ( wx.SplitterWindow ):
    def __init__( self, parent ):
        wx.SplitterWindow.__init__ ( self, parent, -1, style =
wx.SP_LIVE_UPDATE | wx.SP_3D )

class MyFrame ( wx.Frame ):
    def __init__ ( self, parent ):
        wx.Frame.__init__ ( self, parent, -1, ":(", size=(800, 600),
style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE )

        self.splitter = MySplitter ( self )
        self.p1 = wx.Panel ( self.splitter, style = wx.BORDER_SUNKEN )
        self.p2 = wx.Panel ( self.splitter, style = wx.BORDER_SUNKEN )
        
        self.s2 = MySplitter ( self.p2 )
        self.p3 = wx.Panel ( self.s2, style = wx.BORDER_SUNKEN )
        self.p4 = wx.Panel ( self.s2 , style = wx.BORDER_SUNKEN)
        
        self.splitter.SplitVertically ( self.p1, self.p2,0 )
        self.s2.SplitVertically ( self.p3, self.p4, 0 )
        
        self.splitter.SetMinimumPaneSize ( 200 )
        self.s2.SetMinimumPaneSize ( 200 )
        
        self.Show ( )

class MyApp ( wx.App ):
    def OnInit ( self ):
        frame = MyFrame ( None )
        return True

app = MyApp ( 0 )
app.MainLoop ( )

Hello Donn,

I want to have a splitter inside a splitter - I need an app split into there
vertical panels that can resize.

So, I have been working along this line (see below), can you help?

You could use the MultiSplitterWindow class; this has been implemented
since 2.6.2, coming from a bounty. I believe the implementation in the
demo is from Robin, but IIRC the first working class was from Ricardo.
Anyway, if you look at "More Windows/Controls" =>
"MultiSplitterWindow" you can actually see a sample of this class in
action: switching to "vertical" does exactly what you need, I think.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.virgilio.it/infinity77/

You could use the MultiSplitterWindow class; this has been implemented

Thanks Andrea, don't know why I never saw that one. I'll give it a good
hacking at.

Donn.

Donn Ingle wrote:

Hi all, I have looked on the wiki and have done my best to figure this out,
but I can't get it right and I am running out of fistfuls of hair :slight_smile:

I want to have a splitter inside a splitter - I need an app split into there
vertical panels that can resize.

So, I have been working along this line (see below), can you help?

If you decide to not go with the MultiSplitterWindow Andrea mentioned you can still do it with a nested SplitterWindow, you just need to organize things a little differently. The key is that one splitter needs to be the child of the other one, and is one side of that spltter's splt. For example:

parent
    >
splitter
  > \
  > \
  > splitter
  > > \
  > > \
panel panel panel

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

parent
    >
splitter
  > \
  > \
  > splitter
  > > \
  > > \
panel panel panel

Ah!

Thanks once again Sir Robin!

D.