]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/RowColSizer.py
1 # 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
4 # o Gotta fix the overview.
6 # 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
12 import wx
.lib
.rcsizer
as rcs
14 #----------------------------------------------------------------------
16 class TestPanel(wx
.Panel
):
17 def __init__(self
, parent
):
18 wx
.Panel
.__init
__(self
, parent
, -1)
20 sizer
= rcs
.RowColSizer()
22 text
= "This sizer lays out it's items by row and column "\
23 "that are specified explicitly when the item is \n"\
24 "added to the sizer. Grid cells with nothing in "\
25 "them are supported and column- or row-spanning is \n"\
26 "handled as well. Growable rows and columns are "\
27 "specified just like the wxFlexGridSizer."
29 sizer
.Add(wx
.StaticText(self
, -1, text
), row
=1, col
=1, colspan
=5)
31 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,1)"), flag
=wx
.EXPAND
, row
=3, col
=1)
32 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,2)"), row
=3, col
=2)
33 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,3)"), row
=3, col
=3)
34 sizer
.Add(wx
.TextCtrl(self
, -1, "(3,4)"), row
=3, col
=4)
36 wx
.TextCtrl(self
, -1, "(4,2) span:(2,2)"),
37 flag
=wx
.EXPAND
, row
=4, col
=2, rowspan
=2, colspan
=2
40 sizer
.Add(wx
.TextCtrl(self
, -1, "(6,4)"), row
=6, col
=4)
41 sizer
.Add(wx
.TextCtrl(self
, -1, "(7,2)"), row
=7, col
=2)
42 sizer
.Add(wx
.TextCtrl(self
, -1, "(8,3)"), row
=8, col
=3)
44 wx
.TextCtrl(self
, -1, "(10,1) colspan: 4"),
45 flag
=wx
.EXPAND
, pos
=(10,1), colspan
=4
49 wx
.TextCtrl(self
, -1, "(3,5) rowspan: 8, growable col", style
=wx
.TE_MULTILINE
),
50 flag
=wx
.EXPAND
, pos
=(3,5), size
=(8,1)
53 box
= wx
.BoxSizer(wx
.VERTICAL
)
54 box
.Add(wx
.Button(self
, -1, "A vertical box"), flag
=wx
.EXPAND
)
55 box
.Add(wx
.Button(self
, -1, "sizer put in the"), flag
=wx
.EXPAND
)
56 box
.Add(wx
.Button(self
, -1, "RowColSizer at (12,1)"), flag
=wx
.EXPAND
)
57 sizer
.Add(box
, pos
=(12,1))
60 wx
.TextCtrl(self
, -1, "(12,2) align bottom"),
61 flag
=wx
.ALIGN_BOTTOM
, pos
=(12,2)
65 wx
.TextCtrl(self
, -1, "(12,3) align center"),
66 flag
=wx
.ALIGN_CENTER_VERTICAL
, pos
=(12,3)
69 sizer
.Add(wx
.TextCtrl(self
, -1, "(12,4)"),pos
=(12,4))
71 wx
.TextCtrl(self
, -1, "(12,5) full border"),
72 flag
=wx
.EXPAND|wx
.ALL
, border
=15, pos
=(12,5)
75 sizer
.AddGrowableCol(5)
76 sizer
.AddGrowableRow(9)
78 sizer
.AddSpacer(10,10, pos
=(1,6))
79 sizer
.AddSpacer(10,10, pos
=(13,1))
82 self
.SetAutoLayout(True)
85 #----------------------------------------------------------------------
87 def runTest(frame
, nb
, log
):
92 #----------------------------------------------------------------------
95 overview
= rcs
.__doc
__
97 if __name__
== '__main__':
100 run
.main(['', os
.path
.basename(sys
.argv
[0])])