]>
Commit | Line | Data |
---|---|---|
1 | # 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net) | |
2 | # | |
3 | # o Updated for wx namespace | |
4 | # o Gotta fix the overview. | |
5 | # | |
6 | # 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net) | |
7 | # | |
8 | # o Overview fixed. | |
9 | # | |
10 | ||
11 | import wx | |
12 | import wx.lib.rcsizer as rcs | |
13 | ||
14 | #---------------------------------------------------------------------- | |
15 | ||
16 | class TestPanel(wx.Panel): | |
17 | def __init__(self, parent): | |
18 | wx.Panel.__init__(self, parent, -1) | |
19 | ||
20 | sizer = rcs.RowColSizer() | |
21 | ||
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." | |
28 | ||
29 | sizer.Add(wx.StaticText(self, -1, text), row=1, col=1, colspan=5) | |
30 | ||
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) | |
35 | sizer.Add( | |
36 | wx.TextCtrl(self, -1, "(4,2) span:(2,2)"), | |
37 | flag=wx.EXPAND, row=4, col=2, rowspan=2, colspan=2 | |
38 | ) | |
39 | ||
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) | |
43 | sizer.Add( | |
44 | wx.TextCtrl(self, -1, "(10,1) colspan: 4"), | |
45 | flag=wx.EXPAND, pos=(10,1), colspan=4 | |
46 | ) | |
47 | ||
48 | sizer.Add( | |
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) | |
51 | ) | |
52 | ||
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)) | |
58 | ||
59 | sizer.Add( | |
60 | wx.TextCtrl(self, -1, "(12,2) align bottom"), | |
61 | flag=wx.ALIGN_BOTTOM, pos=(12,2) | |
62 | ) | |
63 | ||
64 | sizer.Add( | |
65 | wx.TextCtrl(self, -1, "(12,3) align center"), | |
66 | flag=wx.ALIGN_CENTER_VERTICAL, pos=(12,3) | |
67 | ) | |
68 | ||
69 | sizer.Add(wx.TextCtrl(self, -1, "(12,4)"),pos=(12,4)) | |
70 | sizer.Add( | |
71 | wx.TextCtrl(self, -1, "(12,5) full border"), | |
72 | flag=wx.EXPAND|wx.ALL, border=15, pos=(12,5) | |
73 | ) | |
74 | ||
75 | sizer.AddGrowableCol(5) | |
76 | sizer.AddGrowableRow(9) | |
77 | ||
78 | sizer.AddSpacer(10,10, pos=(1,6)) | |
79 | sizer.AddSpacer(10,10, pos=(13,1)) | |
80 | ||
81 | self.SetSizer(sizer) | |
82 | self.SetAutoLayout(True) | |
83 | ||
84 | ||
85 | #---------------------------------------------------------------------- | |
86 | ||
87 | def runTest(frame, nb, log): | |
88 | win = TestPanel(nb) | |
89 | return win | |
90 | ||
91 | ||
92 | #---------------------------------------------------------------------- | |
93 | ||
94 | ||
95 | overview = rcs.__doc__ | |
96 | ||
97 | if __name__ == '__main__': | |
98 | import sys,os | |
99 | import run | |
100 | run.main(['', os.path.basename(sys.argv[0])]) | |
101 |