]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-11/gridbagsizer.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-11 / gridbagsizer.py
1 import wx
2 from blockwindow import BlockWindow
3
4 labels = "one two three four five six seven eight nine".split()
5
6 class 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
31 app = wx.PySimpleApp()
32 TestFrame().Show()
33
34 app.MainLoop()