]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/RowColSizer.py
3 import wx
.lib
.rcsizer
as rcs
5 #----------------------------------------------------------------------
7 class TestPanel(wx
.Panel
):
8 def __init__(self
, parent
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 sizer
= rcs
.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."
20 sizer
.Add(wx
.StaticText(self
, -1, text
), row
=1, col
=1, colspan
=5)
22 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,1)"), flag
=wx
.EXPAND
, row
=3, col
=1)
23 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,2)"), row
=3, col
=2)
24 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,3)"), row
=3, col
=3)
25 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,4)"), row
=3, col
=4)
27 wx
.TextCtrl(self
, -1, "(4,2) span:(2,2)"),
28 flag
=wx
.EXPAND
, row
=4, col
=2, rowspan
=2, colspan
=2
31 sizer
.Add(wx
.TextCtrl(self
, -1, "(6,4)"), row
=6, col
=4)
32 sizer
.Add(wx
.TextCtrl(self
, -1, "(7,2)"), row
=7, col
=2)
33 sizer
.Add(wx
.TextCtrl(self
, -1, "(8,3)"), row
=8, col
=3)
35 wx
.TextCtrl(self
, -1, "(10,1) colspan: 4"),
36 flag
=wx
.EXPAND
, pos
=(10,1), colspan
=4
40 wx
.TextCtrl(self
, -1, "(3,5) rowspan: 8, growable col", style
=wx
.TE_MULTILINE
),
41 flag
=wx
.EXPAND
, pos
=(3,5), size
=(8,1)
44 box
= wx
.BoxSizer(wx
.VERTICAL
)
45 box
.Add(wx
.Button(self
, -1, "A vertical box"), flag
=wx
.EXPAND
)
46 box
.Add(wx
.Button(self
, -1, "sizer put in the"), flag
=wx
.EXPAND
)
47 box
.Add(wx
.Button(self
, -1, "RowColSizer at (12,1)"), flag
=wx
.EXPAND
)
48 sizer
.Add(box
, pos
=(12,1))
51 wx
.TextCtrl(self
, -1, "(12,2) align bottom"),
52 flag
=wx
.ALIGN_BOTTOM
, pos
=(12,2)
56 wx
.TextCtrl(self
, -1, "(12,3) align center"),
57 flag
=wx
.ALIGN_CENTER_VERTICAL
, pos
=(12,3)
60 sizer
.Add(wx
.TextCtrl(self
, -1, "(12,4)"),pos
=(12,4))
62 wx
.TextCtrl(self
, -1, "(12,5) full border"),
63 flag
=wx
.EXPAND|wx
.ALL
, border
=15, pos
=(12,5)
66 sizer
.AddGrowableCol(5)
67 sizer
.AddGrowableRow(9)
69 sizer
.AddSpacer(10,10, pos
=(1,6))
70 sizer
.AddSpacer(10,10, pos
=(13,1))
73 self
.SetAutoLayout(True)
76 #----------------------------------------------------------------------
78 def runTest(frame
, nb
, log
):
83 #----------------------------------------------------------------------
86 overview
= rcs
.__doc
__
88 if __name__
== '__main__':
91 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])