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