]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/wxEditor.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxEditor.py
... / ...
CommitLineData
1# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
5# 11/28/2003 - Jeff Grimmett (grimmtooth@softhome.net)
6#
7# o editor lib hasn't been hit by the renamer yet.
8#
9# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
10#
11# o wxEditor -> Editor
12#
13
14import wx
15import wx.lib.editor as editor
16
17#----------------------------------------------------------------------
18
19def runTest(frame, nb, log):
20 win = wx.Panel(nb, -1)
21 ed = editor.Editor(win, -1, style=wx.SUNKEN_BORDER)
22 box = wx.BoxSizer(wx.VERTICAL)
23 box.Add(ed, 1, wx.ALL|wx.GROW, 1)
24 win.SetSizer(box)
25 win.SetAutoLayout(True)
26
27 ed.SetText(["",
28 "This is a simple text editor, the class name is",
29 "Editor. Type a few lines and try it out.",
30 "",
31 "It uses Windows-style key commands that can be overridden by subclassing.",
32 "Mouse select works. Here are the key commands:",
33 "",
34 "Cursor movement: Arrow keys or mouse",
35 "Beginning of line: Home",
36 "End of line: End",
37 "Beginning of buffer: Control-Home",
38 "End of the buffer: Control-End",
39 "Select text: Hold down Shift while moving the cursor",
40 "Copy: Control-Insert, Control-C",
41 "Cut: Shift-Delete, Control-X",
42 "Paste: Shift-Insert, Control-V",
43 ""])
44
45 return win
46
47#----------------------------------------------------------------------
48
49
50overview = """
51The Editor class implements a simple text editor using wxPython. You
52can create a custom editor by subclassing Editor. Even though much of
53the editor is implemented in Python, it runs surprisingly smoothly on
54normal hardware with small files.
55
56How to use it
57-------------
58The demo code (demo/Editor.py) shows how to use Editor as a simple text
59box. Use the SetText() and GetText() methods to set or get text from
60the component; these both use a list of strings.
61
62The samples/FrogEdit directory has an example of a simple text editor
63application that uses the Editor component.
64
65Subclassing
66-----------
67To add or change functionality, you can subclass this
68component. One example of this might be to change the key
69Alt key commands. In that case you would (for example) override the
70SetAltFuncs() method.
71
72"""
73
74
75
76
77if __name__ == '__main__':
78 import sys,os
79 import run
80 run.main(['', os.path.basename(sys.argv[0])])
81