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