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