]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxGrid.py
info about removal of wxhtml.rc
[wxWidgets.git] / wxPython / demo / wxGrid.py
CommitLineData
f6bcfd97
BP
1
2from wxPython.wx import *
3
4#---------------------------------------------------------------------------
5
6buttonDefs = {
83625579
RD
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'),
f6bcfd97
BP
13 }
14
15
16class 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)
83625579 38 frame = module.TestFrame(None, self.log)
f6bcfd97
BP
39 frame.Show(true)
40
41
42#---------------------------------------------------------------------------
43
44def runTest(frame, nb, log):
45 win = ButtonPanel(nb, log)
46 return win
47
48#---------------------------------------------------------------------------
49
50
51
52
53
54
55
56
57
58
59overview = """\
60<html><body>
61<h2>wxGrid</h2>
62
63This demo shows various ways of using the <b><i>new and
64improved</i></b> wxGrid class. Unfortunatly it has not been
65documented yet, and while it is somewhat backwards compatible, if you
66try to go by the current wxGrid documentation you will probably just
67confuse yourself.
68<p>
69You can look at the sources for these samples to learn a lot about how
70the new classes work.
71<p><ol>
72<li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
73how to catch all the various events.
74
75<p>
76<li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
77uses non-default Cell Editors and Cell Renderers.
78
79<p>
80<li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
81uses a non-default Grid Table. This table is read-only and simply
82generates on the fly a unique string for each cell.
83
84<p>
85<li><a href="GridCustTable.py">GridCustTable.py</a> This grid
86shows how to deal with tables that have non-string data, and how Cell
87Editors and Cell Renderers are automatically chosen based on the data
88type.
89
90<p>
91<li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
92changes how the ENTER key works, moving the current cell left to right
93and wrapping around to the next row when needed.
94</ol>
95<p>
96You can also look at the <a href="data/grid.i">SWIG interface
97file</a> used to generate the grid module for a lot more clues as to
98how things work.
99
100"""
101