help please, splitter windows like in maya or 3ds max
Andrew Rekdal
Thu Mar 13 00:47:32 EDT 2008
This seems to work... split then split each side. then tandem the size.
import wx
class Layout(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
sizer = wx.BoxSizer(wx.HORIZONTAL)
panel = wx.Panel(self,-1)
splitter = wx.SplitterWindow(panel)
sizer_left = wx.BoxSizer(wx.VERTICAL)
panel_left = wx.Panel(splitter,-1)
splitter_left = wx.SplitterWindow(panel_left)
splitter_left.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED,self.leftChange,id=splitter_left.GetId())
panel_left_upper = wx.Panel(splitter_left,style= wx.BORDER_SUNKEN)
panel_left_upper.SetBackgroundColour("WHITE")
panel_left_lower = wx.Panel(splitter_left,style= wx.BORDER_SUNKEN)
splitter_left.SplitHorizontally(panel_left_upper,panel_left_lower)
sizer_left.Add(splitter_left,1,wx.EXPAND)
sizer_right = wx.BoxSizer(wx.VERTICAL)
panel_right = wx.Panel(splitter,-1)
splitter_right =wx.SplitterWindow(panel_right)
splitter_right.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED,self.rightChange,id=splitter_right.GetId())
panel_right_upper = wx.Panel(splitter_right,style= wx.BORDER_SUNKEN)
panel_right_lower = wx.Panel(splitter_right,style= wx.BORDER_SUNKEN)
panel_right_lower.SetBackgroundColour("WHITE")
splitter_right.SplitHorizontally(panel_right_upper,panel_right_lower)
sizer_right.Add(splitter_right,1,wx.EXPAND)
splitter.SplitVertically(panel_left,panel_right)
sizer.Add(splitter,1,wx.EXPAND)
panel.SetSizer(sizer)
panel_left.SetSizer(sizer_left)
panel_right.SetSizer(sizer_right)
self.splitter_left = splitter_left
self.splitter_right = splitter_right
def leftChange(self,event):
pos = self.splitter_left.GetSashPosition()
self.splitter_right.SetSashPosition(pos)
event.Skip()
def rightChange(self,event):
pos = self.splitter_right.GetSashPosition()
self.splitter_left.SetSashPosition(pos)
event.Skip()
app = wx.App(0)
k = Layout(None, -1, 'layout.py')
k.Show(True)
app.MainLoop()
-- Andrew
----- Original Message -----
From: "moonrie" <moonrie at gmail.com>
Newsgroups: comp.lang.python
Sent: Wednesday, March 12, 2008 10:19 PM
Subject: help please, splitter windows like in maya or 3ds max
> hi, everyone there, I am doing a 3D modeling project. I like to do it
> with Python( am a newbie), but have no idea with the wxSplitterWindow
> to create the 4-view windows( top, front, side, perspective), like the
> mfc CSplitterWnd guy),
> anyone can give me some help with wxPython?
>
> thanks in advance.
>
> - moonrie
More information about the Python-list
mailing list