]>
Commit | Line | Data |
---|---|---|
1b55cabf RD |
1 | |
2 | from wxPython.wx import * | |
1918b6f7 | 3 | from wxPython.lib.editor import wxEditor |
1b55cabf RD |
4 | |
5 | #---------------------------------------------------------------------- | |
6 | ||
7 | def runTest(frame, nb, log): | |
8 | win = wxPanel(nb, -1) | |
f2a497dc | 9 | ed = wxEditor(win, -1, style=wxSUNKEN_BORDER) |
1b55cabf RD |
10 | box = wxBoxSizer(wxVERTICAL) |
11 | box.Add(ed, 1, wxALL|wxGROW, 5) | |
1b55cabf RD |
12 | win.SetSizer(box) |
13 | win.SetAutoLayout(true) | |
14 | ||
15 | ed.SetText(["", | |
16 | "This is a simple text editor, the class name is", | |
f0b0b7d4 | 17 | "wxEditor. Type a few lines and try it out.", |
1918b6f7 RD |
18 | "", |
19 | "It uses Windows-style key commands that can be overriden by subclassing.", | |
20 | "Mouse select works. Here are the key commands:", | |
21 | "", | |
22 | "Cursor movement: Arrow keys or mouse", | |
23 | "Beginning of line: Home", | |
24 | "End of line: End", | |
25 | "Beginning of buffer: Control-Home", | |
26 | "End of the buffer: Control-End", | |
27 | "Select text: Hold down Shift while moving the cursor", | |
28 | "Copy: Control-Insert, Control-C", | |
29 | "Cut: Shift-Delete, Control-X", | |
30 | "Paste: Shift-Insert, Control-V", | |
f0b0b7d4 | 31 | ""]) |
1b55cabf | 32 | |
1b55cabf RD |
33 | return win |
34 | ||
35 | #---------------------------------------------------------------------- | |
36 | ||
37 | ||
1918b6f7 RD |
38 | overview = """ |
39 | The wxEditor class implements a simple text editor using wxPython. You | |
40 | can create a custom editor by subclassing wxEditor. Even though much of | |
41 | the editor is implemented in Python, it runs surprisingly smoothly on | |
42 | normal hardware with small files. | |
1b55cabf | 43 | |
1918b6f7 RD |
44 | How to use it |
45 | ------------- | |
46 | The demo code (demo/wxEditor.py) shows how to use wxEditor as a simple text | |
47 | box. Use the SetText() and GetText() methods to set or get text from | |
48 | the component; these both use a list of strings. | |
49 | ||
50 | The samples/FrogEdit directory has an example of a simple text editor | |
51 | application that uses the wxEditor component. | |
52 | ||
53 | Subclassing | |
54 | ----------- | |
55 | To add or change functionality, you can subclass this | |
56 | component. One example of this might be to change the key | |
57 | Alt key commands. In that case you would (for example) override the | |
58 | SetAltFuncs() method. | |
1b55cabf RD |
59 | |
60 | ||
1b55cabf RD |
61 | """ |
62 | ||
63 | ||
64 |