]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
1 | |
2 | import wx | |
3 | import wx.lib.rcsizer as rcs | |
96de41c2 RD |
4 | |
5 | #---------------------------------------------------------------------- | |
6 | ||
8fa876ca | 7 | class TestPanel(wx.Panel): |
96de41c2 | 8 | def __init__(self, parent): |
8fa876ca RD |
9 | wx.Panel.__init__(self, parent, -1) |
10 | ||
11 | sizer = rcs.RowColSizer() | |
96de41c2 | 12 | |
936bea5d RD |
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 | ||
8fa876ca RD |
20 | sizer.Add(wx.StaticText(self, -1, text), row=1, col=1, colspan=5) |
21 | ||
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) | |
26 | sizer.Add( | |
27 | wx.TextCtrl(self, -1, "(4,2) span:(2,2)"), | |
28 | flag=wx.EXPAND, row=4, col=2, rowspan=2, colspan=2 | |
29 | ) | |
30 | ||
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) | |
34 | sizer.Add( | |
35 | wx.TextCtrl(self, -1, "(10,1) colspan: 4"), | |
36 | flag=wx.EXPAND, pos=(10,1), colspan=4 | |
37 | ) | |
38 | ||
39 | sizer.Add( | |
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) | |
42 | ) | |
43 | ||
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) | |
96de41c2 RD |
48 | sizer.Add(box, pos=(12,1)) |
49 | ||
8fa876ca RD |
50 | sizer.Add( |
51 | wx.TextCtrl(self, -1, "(12,2) align bottom"), | |
52 | flag=wx.ALIGN_BOTTOM, pos=(12,2) | |
53 | ) | |
54 | ||
55 | sizer.Add( | |
56 | wx.TextCtrl(self, -1, "(12,3) align center"), | |
57 | flag=wx.ALIGN_CENTER_VERTICAL, pos=(12,3) | |
58 | ) | |
59 | ||
60 | sizer.Add(wx.TextCtrl(self, -1, "(12,4)"),pos=(12,4)) | |
61 | sizer.Add( | |
62 | wx.TextCtrl(self, -1, "(12,5) full border"), | |
63 | flag=wx.EXPAND|wx.ALL, border=15, pos=(12,5) | |
64 | ) | |
96de41c2 RD |
65 | |
66 | sizer.AddGrowableCol(5) | |
67 | sizer.AddGrowableRow(9) | |
68 | ||
69 | sizer.AddSpacer(10,10, pos=(1,6)) | |
70 | sizer.AddSpacer(10,10, pos=(13,1)) | |
71 | ||
72 | self.SetSizer(sizer) | |
1e4a197e | 73 | self.SetAutoLayout(True) |
96de41c2 RD |
74 | |
75 | ||
76 | #---------------------------------------------------------------------- | |
77 | ||
78 | def runTest(frame, nb, log): | |
79 | win = TestPanel(nb) | |
80 | return win | |
81 | ||
82 | ||
83 | #---------------------------------------------------------------------- | |
84 | ||
85 | ||
8fa876ca | 86 | overview = rcs.__doc__ |
1e4a197e RD |
87 | |
88 | if __name__ == '__main__': | |
89 | import sys,os | |
90 | import run | |
91 | run.main(['', os.path.basename(sys.argv[0])]) | |
92 |