]>
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 '),
14 822 : ('GridDragAndDrop', 'Shows how to make a grid a drop target for files'),
18 class ButtonPanel(wxPanel
):
19 def __init__(self
, parent
, log
):
20 wxPanel
.__init
__(self
, parent
, -1)
23 box
= wxBoxSizer(wxVERTICAL
)
25 keys
= buttonDefs
.keys()
28 text
= buttonDefs
[k
][1]
29 btn
= wxButton(self
, k
, text
)
30 box
.Add(btn
, 0, wxALIGN_CENTER|wxALL
, 10)
31 EVT_BUTTON(self
, k
, self
.OnButton
)
33 self
.SetAutoLayout(True)
37 def OnButton(self
, evt
):
38 modName
= buttonDefs
[evt
.GetId()][0]
39 module
= __import__(modName
)
40 frame
= module
.TestFrame(None, self
.log
)
44 #---------------------------------------------------------------------------
46 def runTest(frame
, nb
, log
):
47 win
= ButtonPanel(nb
, log
)
50 #---------------------------------------------------------------------------
65 This demo shows various ways of using the <b><i>new and
66 improved</i></b> wxGrid class. Unfortunatly it has not been
67 documented yet, and while it is somewhat backwards compatible, if you
68 try to go by the current wxGrid documentation you will probably just
71 You can look at the sources for these samples to learn a lot about how
74 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
75 how to catch all the various events.
78 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
79 uses non-default Cell Editors and Cell Renderers.
82 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
83 uses a non-default Grid Table. This table is read-only and simply
84 generates on the fly a unique string for each cell.
87 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid
88 shows how to deal with tables that have non-string data, and how Cell
89 Editors and Cell Renderers are automatically chosen based on the data
93 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
94 changes how the ENTER key works, moving the current cell left to right
95 and wrapping around to the next row when needed.
104 if __name__
== '__main__':
107 run
.main(['', os
.path
.basename(sys
.argv
[0])])