2003-12-09 01:23:28 +00:00
|
|
|
# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
|
|
|
#
|
|
|
|
# o Updated for wx namespace
|
|
|
|
#
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
import wx
|
1999-04-30 03:29:54 +00:00
|
|
|
|
1999-12-11 07:59:23 +00:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
class MySplitter(wx.SplitterWindow):
|
1999-12-11 07:59:23 +00:00
|
|
|
def __init__(self, parent, ID, log):
|
2003-12-09 01:23:28 +00:00
|
|
|
wx.SplitterWindow.__init__(self, parent, ID)
|
1999-12-11 07:59:23 +00:00
|
|
|
self.log = log
|
2003-12-09 01:23:28 +00:00
|
|
|
|
|
|
|
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
|
|
|
|
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
|
1999-12-11 07:59:23 +00:00
|
|
|
|
|
|
|
def OnSashChanged(self, evt):
|
2000-10-30 21:08:42 +00:00
|
|
|
self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
|
|
|
|
# uncomment this to not allow the change
|
|
|
|
#evt.SetSashPosition(-1)
|
|
|
|
|
|
|
|
def OnSashChanging(self, evt):
|
|
|
|
self.log.WriteText("sash changing to %s\n" % str(evt.GetSashPosition()))
|
|
|
|
# uncomment this to not allow the change
|
|
|
|
#evt.SetSashPosition(-1)
|
1999-12-11 07:59:23 +00:00
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
1999-12-11 07:59:23 +00:00
|
|
|
splitter = MySplitter(nb, -1, log)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
p1 = wx.Window(splitter, -1)
|
|
|
|
p1.SetBackgroundColour(wx.RED)
|
|
|
|
wx.StaticText(p1, -1, "Panel One", (5,5)).SetBackgroundColour(wx.RED)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
p2 = wx.Window(splitter, -1)
|
|
|
|
p2.SetBackgroundColour(wx.BLUE)
|
|
|
|
wx.StaticText(p2, -1, "Panel Two", (5,5)).SetBackgroundColour(wx.BLUE)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
1999-09-30 07:11:20 +00:00
|
|
|
splitter.SetMinimumPaneSize(20)
|
2003-03-25 06:35:27 +00:00
|
|
|
splitter.SplitVertically(p1, p2, 100)
|
|
|
|
|
1999-04-30 03:29:54 +00:00
|
|
|
return splitter
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2003-07-02 23:13:10 +00:00
|
|
|
This class manages up to two subwindows. The current view can be split
|
|
|
|
into two programmatically (perhaps from a menu command), and unsplit
|
|
|
|
either programmatically or via the wxSplitterWindow user interface.
|
|
|
|
"""
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2003-07-02 23:13:10 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
1999-04-30 03:29:54 +00:00
|
|
|
|