]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-05/gridGeneric.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 / gridGeneric.py
1 import wx
2 import wx.grid
3 import generictable
4
5
6 data = (("Bob", "Dernier"), ("Ryne", "Sandberg"),
7 ("Gary", "Matthews"), ("Leon", "Durham"),
8 ("Keith", "Moreland"), ("Ron", "Cey"),
9 ("Jody", "Davis"), ("Larry", "Bowa"),
10 ("Rick", "Sutcliffe"))
11
12 colLabels = ("Last", "First")
13 rowLabels = ("CF", "2B", "LF", "1B", "RF", "3B", "C", "SS", "P")
14
15
16 class SimpleGrid(wx.grid.Grid):
17 def __init__(self, parent):
18 wx.grid.Grid.__init__(self, parent, -1)
19 tableBase = generictable.GenericTable(data, rowLabels,
20 colLabels)
21 self.SetTable(tableBase)
22
23 class TestFrame(wx.Frame):
24 def __init__(self, parent):
25 wx.Frame.__init__(self, parent, -1, "A Grid",
26 size=(275, 275))
27 grid = SimpleGrid(self)
28
29 if __name__ == '__main__':
30 app = wx.PySimpleApp()
31 frame = TestFrame(None)
32 frame.Show(True)
33 app.MainLoop()
34