]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/wxPIA_book/Chapter-11/gridbagsizer.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-11 / gridbagsizer.py
CommitLineData
be05b434
RD
1import wx
2from blockwindow import BlockWindow
3
4labels = "one two three four five six seven eight nine".split()
5
6class TestFrame(wx.Frame):
7 def __init__(self):
8 wx.Frame.__init__(self, None, -1, "GridBagSizer Test")
9 sizer = wx.GridBagSizer(hgap=5, vgap=5)
10 for col in range(3):
11 for row in range(3):
12 bw = BlockWindow(self, label=labels[row*3 + col])
13 sizer.Add(bw, pos=(row,col))
14
15 # add a window that spans several rows
16 bw = BlockWindow(self, label="span 3 rows")
17 sizer.Add(bw, pos=(0,3), span=(3,1), flag=wx.EXPAND)
18
19 # add a window that spans all columns
20 bw = BlockWindow(self, label="span all columns")
21 sizer.Add(bw, pos=(3,0), span=(1,4), flag=wx.EXPAND)
22
23 # make the last row and col be stretchable
24 sizer.AddGrowableCol(3)
25 sizer.AddGrowableRow(3)
26
27 self.SetSizer(sizer)
28 self.Fit()
29
30
31app = wx.PySimpleApp()
32TestFrame().Show()
33
34app.MainLoop()