]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Grid.py
   4 #--------------------------------------------------------------------------- 
   7     814 : ('GridSimple',      ' Simple wx.Grid, catching all events '), 
   8     815 : ('GridStdEdRend',   ' wx.Grid showing Editors and Renderers '), 
   9     818 : ('GridHugeTable',   ' A wx.Grid with a HUGE table (100 MILLION cells!) '), 
  10     817 : ('GridCustTable',   ' wx.Grid 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 wx.Grid with dragable rows and columns '), 
  14     822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'), 
  18 class ButtonPanel(wx
.Panel
): 
  19     def __init__(self
, parent
, log
): 
  20         wx
.Panel
.__init
__(self
, parent
, -1) 
  23         box 
= wx
.BoxSizer(wx
.VERTICAL
) 
  25         keys 
= buttonDefs
.keys() 
  29             text 
= buttonDefs
[k
][1] 
  30             btn 
= wx
.Button(self
, k
, text
) 
  31             box
.Add(btn
, 0, wx
.ALIGN_CENTER|wx
.ALL
, 10) 
  32             self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, btn
) 
  34         self
.SetAutoLayout(True) 
  38     def OnButton(self
, evt
): 
  39         modName 
= buttonDefs
[evt
.GetId()][0] 
  40         module 
= __import__(modName
) 
  41         frame 
= module
.TestFrame(None, self
.log
) 
  45 #--------------------------------------------------------------------------- 
  47 def runTest(frame
, nb
, log
): 
  48     win 
= ButtonPanel(nb
, log
) 
  51 #--------------------------------------------------------------------------- 
  59 This demo shows various ways of using the <b><i>new and 
  60 improved</i></b> wx.Grid class.  Unfortunatly it has not been 
  61 documented yet, and while it is somewhat backwards compatible, if you 
  62 try to go by the current wx.Grid documentation you will probably just 
  65 You can look at the sources for these samples to learn a lot about how 
  68 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows 
  69 how to catch all the various events. 
  72 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that 
  73 uses non-default Cell Editors and Cell Renderers. 
  76 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that 
  77 uses a non-default Grid Table.  This table is read-only and simply 
  78 generates on the fly a unique string for each cell. 
  81 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid 
  82 shows how to deal with tables that have non-string data, and how Cell 
  83 Editors and Cell Renderers are automatically chosen based on the data 
  87 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one 
  88 changes how the ENTER key works, moving the current cell left to right 
  89 and wrapping around to the next row when needed. 
  96 if __name__ 
== '__main__': 
  99     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])