wx.SplitterWindow for box sizers

I have this skeleton BoxSizer frame I’m trying to add a split window.
Like 2 sets of TextCtrls side by side. How do I do this with this sample?

import wx

class MainFrame(wx.Frame):
def init(self):
wx.Frame.init(self,None,wx.ID_ANY,title=‘my panel’)
self.hbox = wx.BoxSizer()
self.vbox= wx.BoxSizer(wx.VERTICAL)

    self.background = wx.Panel(self)
    self.top = wx.TextCtrl(self.background,style=wx.PROCESS_ENTER)
    self.top.Bind(wx.EVT_TEXT_ENTER,self.transevent)
    self.middleview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)
    self.bottomview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)

    self.hbox.Add(self.top,proportion = 1,border=0)
    self.vbox.Add(self.hbox,proportion = 0,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.middleview,proportion=1,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.bottomview,proportion=1,flag = wx.EXPAND,border=0)

    self.background.SetSizer(self.vbox)
    self.Show()
def openevent(self,event):
    pass    
def transevent(self,event):
    pass

app = wx.App(redirect=False)
frame = MainFrame()
app.MainLoop()

Hi,

···

On Monday, September 30, 2013 9:45:49 PM UTC-5, George McCown wrote:

I have this skeleton BoxSizer frame I’m trying to add a split window.
Like 2 sets of TextCtrls side by side. How do I do this with this sample?

import wx

class MainFrame(wx.Frame):
def init(self):
wx.Frame.init(self,None,wx.ID_ANY,title=‘my panel’)
self.hbox = wx.BoxSizer()
self.vbox= wx.BoxSizer(wx.VERTICAL)

    self.background = wx.Panel(self)
    self.top = wx.TextCtrl(self.background,style=wx.PROCESS_ENTER)
    self.top.Bind(wx.EVT_TEXT_ENTER,self.transevent)
    self.middleview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)
    self.bottomview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)

    self.hbox.Add(self.top,proportion = 1,border=0)
    self.vbox.Add(self.hbox,proportion = 0,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.middleview,proportion=1,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.bottomview,proportion=1,flag = wx.EXPAND,border=0)

    self.background.SetSizer(self.vbox)
    self.Show()
def openevent(self,event):
    pass    
def transevent(self,event):
    pass

app = wx.App(redirect=False)
frame = MainFrame()
app.MainLoop()

If you want to put two TextCtrls side-by-side, I would just use a wx.BoxSizer in HORIZONTAL mode. If you really want a SplitterWindow, then you need to actually create one. There’s an example of how to do so in the wxPython demo. Or you can look at some of my experiments with the SplitterWindow at the following:

I should probably write an article about this widget as it’s one of the more confusing ones…

Mike

The slitter_ex example is set up using class left and right panel. I like that organization. Thanks Mike.

···

On Tuesday, October 1, 2013 8:54:57 AM UTC-5, Mike Driscoll wrote:

Hi,

On Monday, September 30, 2013 9:45:49 PM UTC-5, George McCown wrote:

I have this skeleton BoxSizer frame I’m trying to add a split window.
Like 2 sets of TextCtrls side by side. How do I do this with this sample?

import wx

class MainFrame(wx.Frame):
def init(self):
wx.Frame.init(self,None,wx.ID_ANY,title=‘my panel’)
self.hbox = wx.BoxSizer()
self.vbox= wx.BoxSizer(wx.VERTICAL)

    self.background = wx.Panel(self)
    self.top = wx.TextCtrl(self.background,style=wx.PROCESS_ENTER)
    self.top.Bind(wx.EVT_TEXT_ENTER,self.transevent)
    self.middleview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)
    self.bottomview = wx.TextCtrl(self.background,style = wx.TE_MULTILINE|wx.TE_RICH|wx.TE_NOHIDESEL)

    self.hbox.Add(self.top,proportion = 1,border=0)
    self.vbox.Add(self.hbox,proportion = 0,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.middleview,proportion=1,flag = wx.EXPAND,border=0)
    self.vbox.Add(self.bottomview,proportion=1,flag = wx.EXPAND,border=0)

    self.background.SetSizer(self.vbox)
    self.Show()
def openevent(self,event):
    pass    
def transevent(self,event):
    pass

app = wx.App(redirect=False)
frame = MainFrame()
app.MainLoop()

If you want to put two TextCtrls side-by-side, I would just use a wx.BoxSizer in HORIZONTAL mode. If you really want a SplitterWindow, then you need to actually create one. There’s an example of how to do so in the wxPython demo. Or you can look at some of my experiments with the SplitterWindow at the following:

I should probably write an article about this widget as it’s one of the more confusing ones…

Mike