]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxGrid.py
2 from wxPython
.wx
import *
4 #---------------------------------------------------------------------------
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 '),
17 class ButtonPanel(wxPanel
):
18 def __init__(self
, parent
, log
):
19 wxPanel
.__init
__(self
, parent
, -1)
22 box
= wxBoxSizer(wxVERTICAL
)
24 keys
= buttonDefs
.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
)
32 self
.SetAutoLayout(True)
36 def OnButton(self
, evt
):
37 modName
= buttonDefs
[evt
.GetId()][0]
38 module
= __import__(modName
)
39 frame
= module
.TestFrame(None, self
.log
)
43 #---------------------------------------------------------------------------
45 def runTest(frame
, nb
, log
):
46 win
= ButtonPanel(nb
, log
)
49 #---------------------------------------------------------------------------
64 This demo shows various ways of using the <b><i>new and
65 improved</i></b> wxGrid class. Unfortunatly it has not been
66 documented yet, and while it is somewhat backwards compatible, if you
67 try to go by the current wxGrid documentation you will probably just
70 You can look at the sources for these samples to learn a lot about how
73 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
74 how to catch all the various events.
77 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
78 uses non-default Cell Editors and Cell Renderers.
81 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
82 uses a non-default Grid Table. This table is read-only and simply
83 generates on the fly a unique string for each cell.
86 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid
87 shows how to deal with tables that have non-string data, and how Cell
88 Editors and Cell Renderers are automatically chosen based on the data
92 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
93 changes how the ENTER key works, moving the current cell left to right
94 and wrapping around to the next row when needed.
97 You can also look at the <a href="data/grid.i">SWIG interface
98 file</a> used to generate the grid module for a lot more clues as to
106 if __name__
== '__main__':
109 run
.main(['', os
.path
.basename(sys
.argv
[0])])