]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/GridHugeTable.py
Some little additions to how wxBufferedDC is wrapped.
[wxWidgets.git] / wxPython / demo / GridHugeTable.py
CommitLineData
f6bcfd97
BP
1from wxPython.wx import *
2from wxPython.grid import *
3
4#---------------------------------------------------------------------------
5
6class HugeTable(wxPyGridTableBase):
7
8 """
9 This is all it takes to make a custom data table to plug into a
10 wxGrid. There are many more methods that can be overridden, but
11 the ones shown below are the required ones. This table simply
12 provides strings containing the row and column values.
13 """
14
15 def __init__(self, log):
16 wxPyGridTableBase.__init__(self)
17 self.log = log
18
19 def GetNumberRows(self):
20 return 10000
21
22 def GetNumberCols(self):
23 return 10000
24
25 def IsEmptyCell(self, row, col):
26 return false
27
28 def GetValue(self, row, col):
29 return str( (row, col) )
30
31 def SetValue(self, row, col, value):
32 self.log.write('SetValue(%d, %d, "%s") ignored.\n' % (row, col, value))
33
34
35#---------------------------------------------------------------------------
36
37
38
39class HugeTableGrid(wxGrid):
40 def __init__(self, parent, log):
41 wxGrid.__init__(self, parent, -1)
42
43 table = HugeTable(log)
44
45 # The second parameter means that the grid is to take ownership of the
46 # table and will destroy it when done. Otherwise you would need to keep
47 # a reference to it and call it's Destroy method later.
48 self.SetTable(table, true)
49
50
51
52#---------------------------------------------------------------------------
53
54class TestFrame(wxFrame):
55 def __init__(self, parent, log):
56 wxFrame.__init__(self, parent, -1, "Huge (virtual) Table Demo", size=(640,480))
57 grid = HugeTableGrid(self, log)
58
9416aa89 59 grid.SetReadOnly(5,5, true)
f6bcfd97
BP
60
61#---------------------------------------------------------------------------
62
63if __name__ == '__main__':
64 import sys
65 app = wxPySimpleApp()
66 frame = TestFrame(None, sys.stdout)
67 frame.Show(true)
68 app.MainLoop()
69
70
71#---------------------------------------------------------------------------