]> git.saurik.com Git - wxWidgets.git/blame - wxPython/samples/wxPIA_book/Chapter-14/grid_table_basic.py
added missing button state
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-14 / grid_table_basic.py
CommitLineData
be05b434
RD
1import wx
2import wx.grid
3
4class TestTable(wx.grid.PyGridTableBase):
5 def __init__(self):
6 wx.grid.PyGridTableBase.__init__(self)
7 self.rowLabels = ["uno", "dos", "tres", "quatro", "cinco"]
8 self.colLabels = ["homer", "marge", "bart", "lisa", "maggie"]
9
10 def GetNumberRows(self):
11 return 5
12
13 def GetNumberCols(self):
14 return 5
15
16 def IsEmptyCell(self, row, col):
17 return False
18
19 def GetValue(self, row, col):
20 return "(%s,%s)" % (self.rowLabels[row], self.colLabels[col])
21
22 def SetValue(self, row, col, value):
23 pass
24
25 def GetColLabelValue(self, col):
26 return self.colLabels[col]
27
28 def GetRowLabelValue(self, row):
29 return self.rowLabels[row]
30
31class TestFrame(wx.Frame):
32 def __init__(self):
33 wx.Frame.__init__(self, None, title="Grid Table",
34 size=(500,200))
35 grid = wx.grid.Grid(self)
36 table = TestTable()
37 grid.SetTable(table, True)
38
39app = wx.PySimpleApp()
40frame = TestFrame()
41frame.Show()
42app.MainLoop()