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