]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxGrid.py
use Arial if available
[wxWidgets.git] / wxPython / demo / wxGrid.py
1
2 from wxPython.wx import *
3
4 #---------------------------------------------------------------------------
5
6 buttonDefs = {
7 814 : ('GridSimple', 'Simple wxGrid, catching all events'),
8 815 : ('GridStdEdRend', 'wxGrid showing Editors and Renderers'),
9 818 : ('GridHugeTable', 'A wxGrid with a HUGE table (100 MILLION cells!)'),
10 817 : ('GridCustTable', 'wxGrid using a custom Table, with non-string data'),
11 819 : ('GridEnterHandler','Remapping keys to behave differently'),
12 820 : ('GridCustEditor', 'Shows how to create a custom Cell Editor'),
13 }
14
15
16 class ButtonPanel(wxPanel):
17 def __init__(self, parent, log):
18 wxPanel.__init__(self, parent, -1)
19 self.log = log
20
21 box = wxBoxSizer(wxVERTICAL)
22 box.Add(20, 30)
23 keys = buttonDefs.keys()
24 keys.sort()
25 for k in keys:
26 text = buttonDefs[k][1]
27 btn = wxButton(self, k, text)
28 box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
29 EVT_BUTTON(self, k, self.OnButton)
30
31 self.SetAutoLayout(true)
32 self.SetSizer(box)
33
34
35 def OnButton(self, evt):
36 modName = buttonDefs[evt.GetId()][0]
37 module = __import__(modName)
38 frame = module.TestFrame(None, self.log)
39 frame.Show(true)
40
41
42 #---------------------------------------------------------------------------
43
44 def runTest(frame, nb, log):
45 win = ButtonPanel(nb, log)
46 return win
47
48 #---------------------------------------------------------------------------
49
50
51
52
53
54
55
56
57
58
59 overview = """\
60 <html><body>
61 <h2>wxGrid</h2>
62
63 This demo shows various ways of using the <b><i>new and
64 improved</i></b> wxGrid class. Unfortunatly it has not been
65 documented yet, and while it is somewhat backwards compatible, if you
66 try to go by the current wxGrid documentation you will probably just
67 confuse yourself.
68 <p>
69 You can look at the sources for these samples to learn a lot about how
70 the new classes work.
71 <p><ol>
72 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
73 how to catch all the various events.
74
75 <p>
76 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
77 uses non-default Cell Editors and Cell Renderers.
78
79 <p>
80 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
81 uses a non-default Grid Table. This table is read-only and simply
82 generates on the fly a unique string for each cell.
83
84 <p>
85 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid
86 shows how to deal with tables that have non-string data, and how Cell
87 Editors and Cell Renderers are automatically chosen based on the data
88 type.
89
90 <p>
91 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
92 changes how the ENTER key works, moving the current cell left to right
93 and wrapping around to the next row when needed.
94 </ol>
95 <p>
96 You can also look at the <a href="data/grid.i">SWIG interface
97 file</a> used to generate the grid module for a lot more clues as to
98 how things work.
99
100 """
101