]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/Grid.py
Initialize m_privData before doign the assignment
[wxWidgets.git] / wxPython / demo / Grid.py
CommitLineData
f6bcfd97 1
8fa876ca 2import wx
f6bcfd97
BP
3
4#---------------------------------------------------------------------------
5
6buttonDefs = {
95bfd958
RD
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 '),
1e4a197e
RD
11 819 : ('GridEnterHandler',' Remapping keys to behave differently '),
12 820 : ('GridCustEditor', ' Shows how to create a custom Cell Editor '),
95bfd958 13 821 : ('GridDragable', ' A wx.Grid with dragable rows and columns '),
8fa876ca 14 822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'),
f6bcfd97
BP
15 }
16
17
8fa876ca 18class ButtonPanel(wx.Panel):
f6bcfd97 19 def __init__(self, parent, log):
8fa876ca 20 wx.Panel.__init__(self, parent, -1)
f6bcfd97
BP
21 self.log = log
22
372bde9b 23 box = wx.BoxSizer(wx.VERTICAL)
fbd5dd1d 24 box.Add((20, 20))
f6bcfd97
BP
25 keys = buttonDefs.keys()
26 keys.sort()
8fa876ca 27
f6bcfd97
BP
28 for k in keys:
29 text = buttonDefs[k][1]
8fa876ca
RD
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)
f6bcfd97 33
1e4a197e 34 self.SetAutoLayout(True)
f6bcfd97
BP
35 self.SetSizer(box)
36
37
38 def OnButton(self, evt):
39 modName = buttonDefs[evt.GetId()][0]
40 module = __import__(modName)
83625579 41 frame = module.TestFrame(None, self.log)
1e4a197e 42 frame.Show(True)
f6bcfd97
BP
43
44
45#---------------------------------------------------------------------------
46
47def runTest(frame, nb, log):
48 win = ButtonPanel(nb, log)
49 return win
50
51#---------------------------------------------------------------------------
52
53
54
f6bcfd97
BP
55overview = """\
56<html><body>
95bfd958 57<h2>wx.Grid</h2>
f6bcfd97
BP
58
59This demo shows various ways of using the <b><i>new and
95bfd958 60improved</i></b> wx.Grid class. Unfortunatly it has not been
f6bcfd97 61documented yet, and while it is somewhat backwards compatible, if you
95bfd958 62try to go by the current wx.Grid documentation you will probably just
f6bcfd97
BP
63confuse yourself.
64<p>
65You can look at the sources for these samples to learn a lot about how
66the new classes work.
67<p><ol>
68<li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
69how to catch all the various events.
70
71<p>
72<li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
73uses non-default Cell Editors and Cell Renderers.
74
75<p>
76<li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
77uses a non-default Grid Table. This table is read-only and simply
78generates on the fly a unique string for each cell.
79
80<p>
81<li><a href="GridCustTable.py">GridCustTable.py</a> This grid
82shows how to deal with tables that have non-string data, and how Cell
83Editors and Cell Renderers are automatically chosen based on the data
84type.
85
86<p>
87<li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
88changes how the ENTER key works, moving the current cell left to right
89and wrapping around to the next row when needed.
90</ol>
91<p>
f6bcfd97
BP
92
93"""
94
f19533bf 95
f19533bf
RD
96if __name__ == '__main__':
97 import sys,os
98 import run
8eca4fef 99 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
f19533bf 100