]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/VirtualListCtrl.py
use Arial if available
[wxWidgets.git] / wxPython / demo / VirtualListCtrl.py
1
2
3 from wxPython.wx import *
4
5 #----------------------------------------------------------------------
6
7 class TestVirtualList(wxListCtrl):
8 def __init__(self, parent, log):
9 wxListCtrl.__init__(self, parent, -1,
10 style=wxLC_REPORT|wxLC_VIRTUAL|wxLC_HRULES|wxLC_VRULES)
11 self.log = log
12
13 self.InsertColumn(0, "First")
14 self.InsertColumn(1, "Second")
15 self.InsertColumn(2, "Third")
16 self.SetColumnWidth(0, 175)
17 self.SetColumnWidth(1, 175)
18 self.SetColumnWidth(2, 175)
19
20 self.SetItemCount(1000000)
21
22 self.attr1 = wxListItemAttr()
23 self.attr1.SetBackgroundColour("yellow")
24
25 self.attr2 = wxListItemAttr()
26 self.attr2.SetBackgroundColour("light blue")
27
28
29 def OnGetItemText(self, item, col):
30 return "Item %d, column %d" % (item, col)
31
32 def OnGetItemImage(self, item):
33 return 0
34
35 def OnGetItemAttr(self, item):
36 if item % 3 == 1:
37 return self.attr1
38 elif item % 3 == 2:
39 return self.attr2
40 else:
41 return None
42
43
44 #----------------------------------------------------------------------
45
46 def runTest(frame, nb, log):
47 win = TestVirtualList(nb, log)
48 return win
49
50 #----------------------------------------------------------------------
51
52
53
54
55
56
57
58
59 overview = """\
60 """