]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxSplitterWindow.py
regenerated after adding DEBUG_ options
[wxWidgets.git] / wxPython / demo / wxSplitterWindow.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4
6999b0d8
RD
5#---------------------------------------------------------------------------
6
7class MySplitter(wxSplitterWindow):
8 def __init__(self, parent, ID, log):
9 wxSplitterWindow.__init__(self, parent, ID)
10 self.log = log
11 EVT_SPLITTER_SASH_POS_CHANGED(self, self.GetId(), self.OnSashChanged)
c368d904 12 EVT_SPLITTER_SASH_POS_CHANGING(self, self.GetId(), self.OnSashChanging)
6999b0d8
RD
13
14 def OnSashChanged(self, evt):
c368d904
RD
15 self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
16 # uncomment this to not allow the change
17 #evt.SetSashPosition(-1)
18
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)
6999b0d8 23
cf694132
RD
24#---------------------------------------------------------------------------
25
26def runTest(frame, nb, log):
6999b0d8 27 splitter = MySplitter(nb, -1, log)
cf694132
RD
28
29 p1 = wxWindow(splitter, -1)
30 p1.SetBackgroundColour(wxRED)
31 wxStaticText(p1, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED)
32
33 p2 = wxWindow(splitter, -1)
34 p2.SetBackgroundColour(wxBLUE)
35 wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE)
36
2f90df85 37 splitter.SetMinimumPaneSize(20)
1e4a197e
RD
38 splitter.SplitVertically(p1, p2, 100)
39
cf694132
RD
40 return splitter
41
42
43#---------------------------------------------------------------------------
44
45
46
47
cf694132 48overview = """\
1fded56b
RD
49This class manages up to two subwindows. The current view can be split
50into two programmatically (perhaps from a menu command), and unsplit
51either programmatically or via the wxSplitterWindow user interface.
52"""
cf694132 53
cf694132 54
cf694132 55
1fded56b
RD
56if __name__ == '__main__':
57 import sys,os
58 import run
59 run.main(['', os.path.basename(sys.argv[0])])
cf694132 60