]> git.saurik.com Git - wxWidgets.git/blame - utils/wxPython/demo/wxSplitterWindow.py
Fixes to avoid an endless event looping for wxGTK
[wxWidgets.git] / utils / wxPython / demo / wxSplitterWindow.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
4
6999b0d8
RD
5#---------------------------------------------------------------------------
6
7class MySplitter(wxSplitterWindow):
8 def __init__(self, parent, ID, log):
9 wxSplitterWindow.__init__(self, parent, ID)
10 self.log = log
11 EVT_SPLITTER_SASH_POS_CHANGED(self, self.GetId(), self.OnSashChanged)
12
13 def OnSashChanged(self, evt):
14 self.log.WriteText("sash changed to " + str(evt.GetSashPosition()))
15
cf694132
RD
16#---------------------------------------------------------------------------
17
18def runTest(frame, nb, log):
6999b0d8 19 splitter = MySplitter(nb, -1, log)
cf694132
RD
20
21 p1 = wxWindow(splitter, -1)
22 p1.SetBackgroundColour(wxRED)
23 wxStaticText(p1, -1, "Panel One", wxPoint(5,5)).SetBackgroundColour(wxRED)
24
25 p2 = wxWindow(splitter, -1)
26 p2.SetBackgroundColour(wxBLUE)
27 wxStaticText(p2, -1, "Panel Two", wxPoint(5,5)).SetBackgroundColour(wxBLUE)
28
2f90df85 29 splitter.SetMinimumPaneSize(20)
cf694132
RD
30 splitter.SplitVertically(p1, p2)
31 splitter.SetSashPosition(100)
cf694132
RD
32
33 return splitter
34
35
36#---------------------------------------------------------------------------
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52overview = """\
53This 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.
54
55wxSplitterWindow()
56-----------------------------------
57
58Default constructor.
59
60wxSplitterWindow(wxWindow* parent, wxWindowID id, int x, const wxPoint& point = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style=wxSP_3D, const wxString& name = "splitterWindow")
61
62Constructor for creating the window.
63
64Parameters
65-------------------
66
67parent = The parent of the splitter window.
68
69id = The window identifier.
70
71pos = The window position.
72
73size = The window size.
74
75style = The window style. See wxSplitterWindow.
76
77name = The window name.
78"""