]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxSplitterWindow.py
2 from wxPython
.wx
import *
5 #---------------------------------------------------------------------------
7 class MySplitter(wxSplitterWindow
):
8 def __init__(self
, parent
, ID
, log
):
9 wxSplitterWindow
.__init
__(self
, parent
, ID
)
11 EVT_SPLITTER_SASH_POS_CHANGED(self
, self
.GetId(), self
.OnSashChanged
)
12 EVT_SPLITTER_SASH_POS_CHANGING(self
, self
.GetId(), self
.OnSashChanging
)
14 def OnSashChanged(self
, evt
):
15 self
.log
.WriteText("sash changed to %s\n" % str(evt
.GetSashPosition()))
16 # uncomment this to not allow the change
17 #evt.SetSashPosition(-1)
19 def OnSashChanging(self
, evt
):
20 self
.log
.WriteText("sash changing to %s\n" % str(evt
.GetSashPosition()))
21 # uncomment this to not allow the change
22 #evt.SetSashPosition(-1)
24 #---------------------------------------------------------------------------
26 def runTest(frame
, nb
, log
):
27 splitter
= MySplitter(nb
, -1, log
)
29 p1
= wxWindow(splitter
, -1)
30 p1
.SetBackgroundColour(wxRED
)
31 wxStaticText(p1
, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED
)
33 p2
= wxWindow(splitter
, -1)
34 p2
.SetBackgroundColour(wxBLUE
)
35 wxStaticText(p2
, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE
)
37 splitter
.SetMinimumPaneSize(20)
38 splitter
.SplitVertically(p1
, p2
, 100)
43 #---------------------------------------------------------------------------
49 This class manages up to two subwindows. The current view can be split
50 into two programmatically (perhaps from a menu command), and unsplit
51 either programmatically or via the wxSplitterWindow user interface.
56 if __name__
== '__main__':
59 run
.main(['', os
.path
.basename(sys
.argv
[0])])