]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxGrid.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / wxGrid.py
1
2 from wxPython.wx import *
3
4 #---------------------------------------------------------------------------
5
6 buttonDefs = {
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 '),
13 821 : ('GridDragable', ' A wxGrid 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(wxPanel):
19 def __init__(self, parent, log):
20 wxPanel.__init__(self, parent, -1)
21 self.log = log
22
23 box = wxBoxSizer(wxVERTICAL)
24 box.Add(20, 30)
25 keys = buttonDefs.keys()
26 keys.sort()
27 for k in keys:
28 text = buttonDefs[k][1]
29 btn = wxButton(self, k, text)
30 box.Add(btn, 0, wxALIGN_CENTER|wxALL, 10)
31 EVT_BUTTON(self, k, self.OnButton)
32
33 self.SetAutoLayout(True)
34 self.SetSizer(box)
35
36
37 def OnButton(self, evt):
38 modName = buttonDefs[evt.GetId()][0]
39 module = __import__(modName)
40 frame = module.TestFrame(None, self.log)
41 frame.Show(True)
42
43
44 #---------------------------------------------------------------------------
45
46 def runTest(frame, nb, log):
47 win = ButtonPanel(nb, log)
48 return win
49
50 #---------------------------------------------------------------------------
51
52
53
54
55
56
57
58
59
60
61 overview = """\
62 <html><body>
63 <h2>wxGrid</h2>
64
65 This demo shows various ways of using the <b><i>new and
66 improved</i></b> wxGrid class. Unfortunatly it has not been
67 documented yet, and while it is somewhat backwards compatible, if you
68 try to go by the current wxGrid documentation you will probably just
69 confuse yourself.
70 <p>
71 You can look at the sources for these samples to learn a lot about how
72 the new classes work.
73 <p><ol>
74 <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
75 how to catch all the various events.
76
77 <p>
78 <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
79 uses non-default Cell Editors and Cell Renderers.
80
81 <p>
82 <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
83 uses a non-default Grid Table. This table is read-only and simply
84 generates on the fly a unique string for each cell.
85
86 <p>
87 <li><a href="GridCustTable.py">GridCustTable.py</a> This grid
88 shows how to deal with tables that have non-string data, and how Cell
89 Editors and Cell Renderers are automatically chosen based on the data
90 type.
91
92 <p>
93 <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
94 changes how the ENTER key works, moving the current cell left to right
95 and wrapping around to the next row when needed.
96 </ol>
97 <p>
98
99 """
100
101
102
103
104 if __name__ == '__main__':
105 import sys,os
106 import run
107 run.main(['', os.path.basename(sys.argv[0])])
108