]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxEditor.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxEditor.py
CommitLineData
8fa876ca
RD
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#
d4b73b1b
RD
9# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
10#
11# o wxEditor -> Editor
12#
8fa876ca
RD
13
14import wx
15import wx.lib.editor as editor
1b55cabf
RD
16
17#----------------------------------------------------------------------
18
19def runTest(frame, nb, log):
8fa876ca 20 win = wx.Panel(nb, -1)
d4b73b1b 21 ed = editor.Editor(win, -1, style=wx.SUNKEN_BORDER)
8fa876ca
RD
22 box = wx.BoxSizer(wx.VERTICAL)
23 box.Add(ed, 1, wx.ALL|wx.GROW, 1)
1b55cabf 24 win.SetSizer(box)
1e4a197e 25 win.SetAutoLayout(True)
1b55cabf
RD
26
27 ed.SetText(["",
28 "This is a simple text editor, the class name is",
d4b73b1b 29 "Editor. Type a few lines and try it out.",
1918b6f7 30 "",
8b9a4190 31 "It uses Windows-style key commands that can be overridden by subclassing.",
1918b6f7
RD
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",
f0b0b7d4 43 ""])
1b55cabf 44
1b55cabf
RD
45 return win
46
47#----------------------------------------------------------------------
48
49
1918b6f7 50overview = """
d4b73b1b
RD
51The Editor class implements a simple text editor using wxPython. You
52can create a custom editor by subclassing Editor. Even though much of
78e8819c 53the editor is implemented in Python, it runs surprisingly smoothly on
1918b6f7 54normal hardware with small files.
1b55cabf 55
1918b6f7
RD
56How to use it
57-------------
d4b73b1b 58The demo code (demo/Editor.py) shows how to use Editor as a simple text
1918b6f7
RD
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
d4b73b1b 63application that uses the Editor component.
1918b6f7
RD
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.
1b55cabf 71
1b55cabf
RD
72"""
73
74
75
6f48b1b5
RD
76
77if __name__ == '__main__':
78 import sys,os
79 import run
80 run.main(['', os.path.basename(sys.argv[0])])
81