1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
1999-04-29 23:29:54 -04:00
|
|
|
|
1999-12-11 02:59:23 -05:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class MySplitter(wx.SplitterWindow):
|
1999-12-11 02:59:23 -05:00
|
|
|
def __init__(self, parent, ID, log):
|
2004-03-04 19:06:33 -05:00
|
|
|
wx.SplitterWindow.__init__(self, parent, ID,
|
|
|
|
style = wx.SP_3D
|
|
|
|
#| wx.SP_LIVE_UPDATE
|
|
|
|
)
|
1999-12-11 02:59:23 -05:00
|
|
|
self.log = log
|
2003-12-08 20:23:28 -05:00
|
|
|
|
|
|
|
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnSashChanged)
|
|
|
|
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.OnSashChanging)
|
1999-12-11 02:59:23 -05:00
|
|
|
|
|
|
|
def OnSashChanged(self, evt):
|
2000-10-30 16:08:42 -05:00
|
|
|
self.log.WriteText("sash changed to %s\n" % str(evt.GetSashPosition()))
|
|
|
|
|
|
|
|
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 02:59:23 -05:00
|
|
|
|
2004-03-04 19:06:33 -05:00
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
1999-12-11 02:59:23 -05:00
|
|
|
splitter = MySplitter(nb, -1, log)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
p1 = wx.Window(splitter, -1)
|
|
|
|
p1.SetBackgroundColour(wx.RED)
|
2004-03-04 19:06:33 -05:00
|
|
|
wx.StaticText(p1, -1, "Panel One", (5,5))#.SetBackgroundColour(wx.RED)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
p2 = wx.Window(splitter, -1)
|
|
|
|
p2.SetBackgroundColour(wx.BLUE)
|
2004-03-04 19:06:33 -05:00
|
|
|
p2.SetForegroundColour(wx.WHITE)
|
|
|
|
wx.StaticText(p2, -1, "Panel Two", (5,5))#.SetBackgroundColour(wx.BLUE)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
1999-09-30 03:11:20 -04:00
|
|
|
splitter.SetMinimumPaneSize(20)
|
2004-03-04 19:06:33 -05:00
|
|
|
splitter.SplitVertically(p1, p2, -100)
|
2003-03-25 01:35:27 -05:00
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
return splitter
|
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2003-07-02 19:13:10 -04:00
|
|
|
This class manages up to two subwindows. The current view can be split
|
|
|
|
into two programmatically (perhaps from a menu command), and unsplit
|
2004-01-12 22:17:17 -05:00
|
|
|
either programmatically or via the wx.SplitterWindow user interface.
|
2003-07-02 19:13:10 -04:00
|
|
|
"""
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2003-07-02 19:13:10 -04:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
1999-04-29 23:29:54 -04:00
|
|
|
|