]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxSplitterWindow.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxSplitterWindow.py
CommitLineData
8fa876ca
RD
1# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
cf694132 5
8fa876ca 6import wx
cf694132 7
6999b0d8
RD
8#---------------------------------------------------------------------------
9
8fa876ca 10class MySplitter(wx.SplitterWindow):
6999b0d8 11 def __init__(self, parent, ID, log):
8fa876ca 12 wx.SplitterWindow.__init__(self, parent, ID)
6999b0d8 13 self.log = log
8fa876ca
RD
14
15 self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
16 self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
6999b0d8
RD
17
18 def OnSashChanged(self, evt):
c368d904
RD
19 self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
20 # uncomment this to not allow the change
21 #evt.SetSashPosition(-1)
22
23 def OnSashChanging(self, evt):
24 self.log.WriteText("sash changing to %s\n" % str(evt.GetSashPosition()))
25 # uncomment this to not allow the change
26 #evt.SetSashPosition(-1)
6999b0d8 27
cf694132
RD
28#---------------------------------------------------------------------------
29
30def runTest(frame, nb, log):
6999b0d8 31 splitter = MySplitter(nb, -1, log)
cf694132 32
8fa876ca
RD
33 p1 = wx.Window(splitter, -1)
34 p1.SetBackgroundColour(wx.RED)
35 wx.StaticText(p1, -1, "Panel One", (5,5)).SetBackgroundColour(wx.RED)
cf694132 36
8fa876ca
RD
37 p2 = wx.Window(splitter, -1)
38 p2.SetBackgroundColour(wx.BLUE)
39 wx.StaticText(p2, -1, "Panel Two", (5,5)).SetBackgroundColour(wx.BLUE)
cf694132 40
2f90df85 41 splitter.SetMinimumPaneSize(20)
1e4a197e
RD
42 splitter.SplitVertically(p1, p2, 100)
43
cf694132
RD
44 return splitter
45
46
47#---------------------------------------------------------------------------
48
49
cf694132 50overview = """\
1fded56b
RD
51This class manages up to two subwindows. The current view can be split
52into two programmatically (perhaps from a menu command), and unsplit
53either programmatically or via the wxSplitterWindow user interface.
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