]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/RowColSizer.py
corrected assert even better
[wxWidgets.git] / wxPython / demo / RowColSizer.py
... / ...
CommitLineData
1
2from wxPython.wx import *
3from wxPython.lib.rcsizer import RowColSizer
4
5
6#----------------------------------------------------------------------
7
8class TestPanel(wxPanel):
9 def __init__(self, parent):
10 wxPanel.__init__(self, parent, -1)
11
12 sizer = RowColSizer()
13 text = "This sizer lays out it's items by row and column "\
14 "that are specified explicitly when the item is \n"\
15 "added to the sizer. Grid cells with nothing in "\
16 "them are supported and column- or row-spanning is \n"\
17 "handled as well. Growable rows and columns are "\
18 "specified just like the wxFlexGridSizer."
19
20 sizer.Add(wxStaticText(self, -1, text), row=1, col=1, colspan=5)
21
22 sizer.Add(wxTextCtrl(self, -1, "(3,1)"), flag=wxEXPAND, row=3, col=1)
23 sizer.Add(wxTextCtrl(self, -1, "(3,2)"), row=3, col=2)
24 sizer.Add(wxTextCtrl(self, -1, "(3,3)"), row=3, col=3)
25 sizer.Add(wxTextCtrl(self, -1, "(3,4)"), row=3, col=4)
26 sizer.Add(wxTextCtrl(self, -1, "(4,2) span:(2,2)"), flag=wxEXPAND,
27 row=4, col=2, rowspan=2, colspan=2)
28 sizer.Add(wxTextCtrl(self, -1, "(6,4)"), row=6, col=4)
29 sizer.Add(wxTextCtrl(self, -1, "(7,2)"), row=7, col=2)
30 sizer.Add(wxTextCtrl(self, -1, "(8,3)"), row=8, col=3)
31 sizer.Add(wxTextCtrl(self, -1, "(10,1) colspan: 4"), flag=wxEXPAND, pos=(10,1), colspan=4)
32 sizer.Add(wxTextCtrl(self, -1, "(3,5) rowspan: 8, growable col", style=wxTE_MULTILINE),
33 flag=wxEXPAND, pos=(3,5), size=(8,1))
34
35 box = wxBoxSizer(wxVERTICAL)
36 box.Add(wxButton(self, -1, "A vertical box"), flag=wxEXPAND)
37 box.Add(wxButton(self, -1, "sizer put in the"), flag=wxEXPAND)
38 box.Add(wxButton(self, -1, "RowColSizer at (12,1)"), flag=wxEXPAND)
39 sizer.Add(box, pos=(12,1))
40
41 sizer.Add(wxTextCtrl(self, -1, "(12,2) align bottom"), flag=wxALIGN_BOTTOM, pos=(12,2))
42 sizer.Add(wxTextCtrl(self, -1, "(12,3) align center"), flag=wxALIGN_CENTER_VERTICAL, pos=(12,3))
43 sizer.Add(wxTextCtrl(self, -1, "(12,4)"),pos=(12,4))
44 sizer.Add(wxTextCtrl(self, -1, "(12,5) full border"), flag=wxEXPAND|wxALL, border=15, pos=(12,5))
45
46 sizer.AddGrowableCol(5)
47 sizer.AddGrowableRow(9)
48
49 sizer.AddSpacer(10,10, pos=(1,6))
50 sizer.AddSpacer(10,10, pos=(13,1))
51
52 self.SetSizer(sizer)
53 self.SetAutoLayout(true)
54
55
56#----------------------------------------------------------------------
57
58def runTest(frame, nb, log):
59 win = TestPanel(nb)
60 return win
61
62
63#----------------------------------------------------------------------
64
65
66import wxPython.lib.rcsizer
67overview = wxPython.lib.rcsizer.__doc__
68
69