]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxEditor.py
Aquire the GIL before raising the NotImplementedError exception
[wxWidgets.git] / wxPython / demo / wxEditor.py
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
10 import wx
11 import wx.lib.editor as editor
12
13 #----------------------------------------------------------------------
14
15 def 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
46 overview = """
47 The wxEditor class implements a simple text editor using wxPython. You
48 can create a custom editor by subclassing wxEditor. Even though much of
49 the editor is implemented in Python, it runs surprisingly smoothly on
50 normal hardware with small files.
51
52 How to use it
53 -------------
54 The demo code (demo/wxEditor.py) shows how to use wxEditor as a simple text
55 box. Use the SetText() and GetText() methods to set or get text from
56 the component; these both use a list of strings.
57
58 The samples/FrogEdit directory has an example of a simple text editor
59 application that uses the wxEditor component.
60
61 Subclassing
62 -----------
63 To add or change functionality, you can subclass this
64 component. One example of this might be to change the key
65 Alt key commands. In that case you would (for example) override the
66 SetAltFuncs() method.
67
68 """
69
70
71
72
73 if __name__ == '__main__':
74 import sys,os
75 import run
76 run.main(['', os.path.basename(sys.argv[0])])
77