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