]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-14/grid_headers.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-14 / grid_headers.py
1 import wx
2 import wx.grid
3
4 class TestFrame(wx.Frame):
5
6 rowLabels = ["uno", "dos", "tres", "quatro", "cinco"]
7 colLabels = ["homer", "marge", "bart", "lisa", "maggie"]
8
9 def __init__(self):
10 wx.Frame.__init__(self, None, title="Grid Headers",
11 size=(500,200))
12 grid = wx.grid.Grid(self)
13 grid.CreateGrid(5,5)
14 for row in range(5):
15 grid.SetRowLabelValue(row, self.rowLabels[row])
16 grid.SetColLabelValue(row, self.colLabels[row])
17 for col in range(5):
18 grid.SetCellValue(row, col,
19 "(%s,%s)" % (self.rowLabels[row], self.colLabels[col]))
20
21 app = wx.PySimpleApp()
22 frame = TestFrame()
23 frame.Show()
24 app.MainLoop()