]>
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'), 
  16 class ButtonPanel(wxPanel
): 
  17     def __init__(self
, parent
, log
): 
  18         wxPanel
.__init
__(self
, parent
, -1) 
  21         box 
= wxBoxSizer(wxVERTICAL
) 
  23         keys 
= buttonDefs
.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
) 
  31         self
.SetAutoLayout(true
) 
  35     def OnButton(self
, evt
): 
  36         modName 
= buttonDefs
[evt
.GetId()][0] 
  37         module 
= __import__(modName
) 
  38         frame 
= module
.TestFrame(None, self
.log
) 
  42 #--------------------------------------------------------------------------- 
  44 def runTest(frame
, nb
, log
): 
  45     win 
= ButtonPanel(nb
, log
) 
  48 #--------------------------------------------------------------------------- 
  63 This demo shows various ways of using the <b><i>new and 
  64 improved</i></b> wxGrid class.  Unfortunatly it has not been 
  65 documented yet, and while it is somewhat backwards compatible, if you 
  66 try to go by the current wxGrid documentation you will probably just 
  69 You can look at the sources for these samples to learn a lot about how 
  72 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows 
  73 how to catch all the various events. 
  76 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that 
  77 uses non-default Cell Editors and Cell Renderers. 
  80 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that 
  81 uses a non-default Grid Table.  This table is read-only and simply 
  82 generates on the fly a unique string for each cell. 
  85 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid 
  86 shows how to deal with tables that have non-string data, and how Cell 
  87 Editors and Cell Renderers are automatically chosen based on the data 
  91 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one 
  92 changes how the ENTER key works, moving the current cell left to right 
  93 and wrapping around to the next row when needed. 
  96 You can also look at the <a href="data/grid.i">SWIG interface 
  97 file</a> used to generate the grid module for a lot more clues as to 
 105 if __name__ 
== '__main__': 
 108     run
.main(['', os
.path
.basename(sys
.argv
[0])])