]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxGrid.py
Tool tweaks and metadata update
[wxWidgets.git] / wxPython / demo / wxGrid.py
1 # 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #---------------------------------------------------------------------------
9
10 buttonDefs = {
11 814 : ('GridSimple', ' Simple wxGrid, catching all events '),
12 815 : ('GridStdEdRend', ' wxGrid showing Editors and Renderers '),
13 818 : ('GridHugeTable', ' A wxGrid with a HUGE table (100 MILLION cells!) '),
14 817 : ('GridCustTable', ' wxGrid using a custom Table, with non-string data '),
15 819 : ('GridEnterHandler',' Remapping keys to behave differently '),
16 820 : ('GridCustEditor', ' Shows how to create a custom Cell Editor '),
17 821 : ('GridDragable', ' A wxGrid with dragable rows and columns '),
18 822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'),
19 }
20
21
22 class ButtonPanel(wx.Panel):
23 def __init__(self, parent, log):
24 wx.Panel.__init__(self, parent, -1)
25 self.log = log
26
27 box = wx.BoxSizer(wx.VERTICAL)
28 box.Add((20, 20))
29 keys = buttonDefs.keys()
30 keys.sort()
31
32 for k in keys:
33 text = buttonDefs[k][1]
34 btn = wx.Button(self, k, text)
35 box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 10)
36 self.Bind(wx.EVT_BUTTON, self.OnButton, btn)
37
38 self.SetAutoLayout(True)
39 self.SetSizer(box)
40
41
42 def OnButton(self, evt):
43 modName = buttonDefs[evt.GetId()][0]
44 module = __import__(modName)
45 frame = module.TestFrame(None, self.log)
46 frame.Show(True)
47
48
49 #---------------------------------------------------------------------------
50
51 def runTest(frame, nb, log):
52 win = ButtonPanel(nb, log)
53 return win
54
55 #---------------------------------------------------------------------------
56
57
58
59 overview = """\
60 <html><body>
61 <h2>wxGrid</h2>
62
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
67 confuse yourself.
68 <p>
69 You can look at the sources for these samples to learn a lot about how
70 the new classes work.
71 <p><ol>
72 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
73 how to catch all the various events.
74
75 <p>
76 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
77 uses non-default Cell Editors and Cell Renderers.
78
79 <p>
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.
83
84 <p>
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
88 type.
89
90 <p>
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.
94 </ol>
95 <p>
96
97 """
98
99
100 if __name__ == '__main__':
101 import sys,os
102 import run
103 run.main(['', os.path.basename(sys.argv[0])])
104