]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-05/lineuptable.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-05 / lineuptable.py
1 import wx
2 import wx.grid
3
4 class LineupEntry:
5
6 def __init__(self, pos, first, last):
7 self.pos = pos
8 self.first = first
9 self.last = last
10
11 class LineupTable(wx.grid.PyGridTableBase):
12
13 colLabels = ("First", "Last")
14 colAttrs = ("first", "last")
15
16 def __init__(self, entries):
17 wx.grid.PyGridTableBase.__init__(self)
18 self.entries = entries
19
20 def GetNumberRows(self):
21 return len(self.entries)
22
23 def GetNumberCols(self):
24 return 2
25
26 def GetColLabelValue(self, col):
27 return self.colLabels[col]
28
29 def GetRowLabelValue(self, col):
30 return self.entries[row].pos
31
32 def IsEmptyCell(self, row, col):
33 return False
34
35 def GetValue(self, row, col):
36 entry = self.entries[row]
37 return getattr(entry, self.colAttrs[col])
38
39 def SetValue(self, row, col, value):
40 pass
41