]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxMultiSash.py
1 from wxPython
.wx
import *
2 from wxPython
.lib
.multisash
import wxMultiSash
3 from wxPython
.stc
import *
5 #---------------------------------------------------------------------------
8 You can drag the little tab on the vertical sash left to create another view,
9 or you can drag the tab on the horizontal sash to the top to create another
12 The red blocks on the sashes will destroy the view (bottom,left) this block
15 A yellow rectangle also highlights the current selected view.
17 By calling GetSaveData on the multiSash control the control will return its
18 contents and the positions of each sash as a dictionary.
19 Calling SetSaveData with such a dictionary will restore the control to the
20 state it was in when it was saved.
22 If the class, that is used as a view, has GetSaveData/SetSaveData implemented,
23 these will also be called to save/restore their state. Any object can be
24 returned by GetSaveData, as it is just another object in the dictionary.
27 #---------------------------------------------------------------------------
29 class TestWindow(wxStyledTextCtrl
):
30 def __init__(self
, parent
):
31 wxStyledTextCtrl
.__init
__(self
, parent
, -1, style
=wxNO_BORDER
)
32 self
.SetMarginWidth(1,0)
33 if wxPlatform
== '__WXMSW__':
37 self
.StyleSetFont(wxSTC_STYLE_DEFAULT
,
38 wxFont(fSize
, wxMODERN
, wxNORMAL
, wxNORMAL
))
39 self
.SetText(sampleText
)
41 class TestFrame(wxFrame
):
42 def __init__(self
, parent
, log
):
43 wxFrame
.__init
__(self
, parent
, -1, "Multi Sash Demo",
45 self
.multi
= wxMultiSash(self
,-1,pos
= wxPoint(0,0),
48 # Use this method to set the default class that will be created when
49 # a new sash is created. The class's constructor needs 1 parameter
50 # which is the parent of the window
51 self
.multi
.SetDefaultChildClass(TestWindow
)
54 #---------------------------------------------------------------------------
57 def runTest(frame
, nb
, log
):
58 multi
= wxMultiSash(nb
, -1, pos
= (0,0), size
= (640,480))
60 # Use this method to set the default class that will be created when
61 # a new sash is created. The class's constructor needs 1 parameter
62 # which is the parent of the window
63 multi
.SetDefaultChildClass(TestWindow
)
67 # win = TestPanel(nb, log)
70 #----------------------------------------------------------------------
74 overview
= """<html><body>
75 <h2><center>wxMultiSash</center></h2>
77 wxMultiSash allows the user to split a window any number of times
78 either horizontally or vertically, and to close the split off windows
86 if __name__
== '__main__':
89 run
.main(['', os
.path
.basename(sys
.argv
[0])])