problem setting the sashposition of a SplitterWindow
Humberto Abdelnur
humberto.abdelnur at loria.fr
Wed Oct 24 02:27:57 PDT 2007
Hi everyone,
I'm having problems setting the sashposition of a SplitterWindow.
In fact, the problem arises every time that one SplitterWindow is a
children of component, in my code a page of a notebook, and that
notebook is one of the windows in a outsider SplitterWindow.
To illustrate the problem, an example code is at end of the mail.
It makes 3 frames, each one of them with a format like
----------------------------
----------------------------
| A | B_1 | B_2 |
----------------------------
Where a main splitter is between panels A and B. And B itself has
another splitter with contains the Panels B_1 and B2.
So, the sashposition of the splitter (A,B) works perfectly. however, i
m not able to set the position for the splitter (B_1,B_2)
Thanks in advance,
Humberto
########################################################
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title, splittersash= (None,None)):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition,
wx.Size(400, 300))
mainsplitter = wx.SplitterWindow(self, -1)
A = wx.Panel(mainsplitter, -1)
A.SetBackgroundColour(wx.LIGHT_GREY)
B = wx.Panel(mainsplitter, -1)
vbox = wx.BoxSizer()
splitter2 = wx.SplitterWindow(B, -1)
B_1 = wx.Panel(splitter2, -1)
B_1.SetBackgroundColour(wx.LIGHT_GREY)
B_2 = wx.Panel(splitter2, -1)
B_2.SetBackgroundColour(wx.WHITE)
splitter2.SplitVertically(B_1, B_2, splittersash[0])
vbox.Add(splitter2, 1, wx.EXPAND)
B.SetSizer(vbox)
mainsplitter.SplitVertically(A, B, splittersash[1])
self.Centre()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = MyFrame(None, -1,
'splitterwindow(FirstSash=100,SecondSash=100)', splittersash=(100,100))
frame.Show(True)
frame = MyFrame(None, -1,
'splitterwindow(FirstSash=100,SecondSash=200)', splittersash=(100,200))
frame.Show(True)
frame = MyFrame(None, -1,
'splitterwindow(FirstSash=200,SecondSash=200)', splittersash=(200,200))
frame.Show(True)
app.MainLoop()
More information about the wxpython-users
mailing list