]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Grid.py
Corrected some comments
[wxWidgets.git] / wxPython / demo / Grid.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
6 buttonDefs = {
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'),
15 }
16
17
18 class ButtonPanel(wx.Panel):
19 def __init__(self, parent, log):
20 wx.Panel.__init__(self, parent, -1)
21 self.log = log
22
23 box = wx.BoxSizer(wx.VERTICAL)
24 box.Add((20, 20))
25 keys = buttonDefs.keys()
26 keys.sort()
27
28 for k in 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)
33
34 self.SetAutoLayout(True)
35 self.SetSizer(box)
36
37
38 def OnButton(self, evt):
39 modName = buttonDefs[evt.GetId()][0]
40 module = __import__(modName)
41 frame = module.TestFrame(None, self.log)
42 frame.Show(True)
43
44
45 #---------------------------------------------------------------------------
46
47 def runTest(frame, nb, log):
48 win = ButtonPanel(nb, log)
49 return win
50
51 #---------------------------------------------------------------------------
52
53
54
55 overview = """\
56 <html><body>
57 <h2>wx.Grid</h2>
58
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
63 confuse yourself.
64 <p>
65 You can look at the sources for these samples to learn a lot about how
66 the new classes work.
67 <p><ol>
68 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
69 how to catch all the various events.
70
71 <p>
72 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
73 uses non-default Cell Editors and Cell Renderers.
74
75 <p>
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.
79
80 <p>
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
84 type.
85
86 <p>
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.
90 </ol>
91 <p>
92
93 """
94
95
96 if __name__ == '__main__':
97 import sys,os
98 import run
99 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
100