]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/SplitterWindow.py
Another package name fix
[wxWidgets.git] / wxPython / demo / SplitterWindow.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132 3
6999b0d8
RD
4#---------------------------------------------------------------------------
5
8fa876ca 6class MySplitter(wx.SplitterWindow):
6999b0d8 7 def __init__(self, parent, ID, log):
8eca4fef 8 wx.SplitterWindow.__init__(self, parent, ID,
c8437398 9 style = wx.SP_LIVE_UPDATE
8eca4fef 10 )
6999b0d8 11 self.log = log
8fa876ca
RD
12
13 self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
14 self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
6999b0d8
RD
15
16 def OnSashChanged(self, evt):
c368d904 17 self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
c368d904
RD
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
8eca4fef 24
cf694132
RD
25#---------------------------------------------------------------------------
26
27def runTest(frame, nb, log):
6999b0d8 28 splitter = MySplitter(nb, -1, log)
cf694132 29
faaa9c81
RD
30 #sty = wx.BORDER_NONE
31 #sty = wx.BORDER_SIMPLE
32 sty = wx.BORDER_SUNKEN
33
34 p1 = wx.Window(splitter, style=sty)
c8437398
RD
35 p1.SetBackgroundColour("pink")
36 wx.StaticText(p1, -1, "Panel One", (5,5))
cf694132 37
faaa9c81 38 p2 = wx.Window(splitter, style=sty)
c8437398
RD
39 p2.SetBackgroundColour("sky blue")
40 wx.StaticText(p2, -1, "Panel Two", (5,5))
cf694132 41
2f90df85 42 splitter.SetMinimumPaneSize(20)
8eca4fef 43 splitter.SplitVertically(p1, p2, -100)
1e4a197e 44
cf694132
RD
45 return splitter
46
47
48#---------------------------------------------------------------------------
49
50
cf694132 51overview = """\
1fded56b
RD
52This class manages up to two subwindows. The current view can be split
53into two programmatically (perhaps from a menu command), and unsplit
95bfd958 54either programmatically or via the wx.SplitterWindow user interface.
1fded56b 55"""
cf694132 56
1fded56b
RD
57if __name__ == '__main__':
58 import sys,os
59 import run
8eca4fef 60 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
cf694132 61