]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-11/bordergridsizer.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-11 / bordergridsizer.py
1 import wx
2 from blockwindow import BlockWindow
3
4 labels = "one two three four five six seven eight nine".split()
5 flags = {"one": wx.BOTTOM, "two": wx.ALL, "three": wx.TOP,
6 "four": wx.LEFT, "five": wx.ALL, "six": wx.RIGHT,
7 "seven": wx.BOTTOM | wx.TOP, "eight": wx.ALL,
8 "nine": wx.LEFT | wx.RIGHT}
9
10 class TestFrame(wx.Frame):
11 def __init__(self):
12 wx.Frame.__init__(self, None, -1, "GridSizer Borders")
13 sizer = wx.GridSizer(rows=3, cols=3, hgap=5, vgap=5)
14 for label in labels:
15 bw = BlockWindow(self, label=label)
16 flag = flags.get(label, 0)
17 sizer.Add(bw, 0, flag, 10)
18 self.SetSizer(sizer)
19 self.Fit()
20
21 app = wx.PySimpleApp()
22 TestFrame().Show()
23 app.MainLoop()