]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Editor.py
   3 import  wx
.lib
.editor    
as  editor
 
   5 #---------------------------------------------------------------------- 
   7 def runTest(frame
, nb
, log
): 
   9     ed 
= editor
.Editor(win
, -1, style
=wx
.SUNKEN_BORDER
) 
  10     box 
= wx
.BoxSizer(wx
.VERTICAL
) 
  11     box
.Add(ed
, 1, wx
.ALL|wx
.GROW
, 1) 
  13     win
.SetAutoLayout(True) 
  16                 "This is a simple text editor, the class name is", 
  17                 "Editor.  Type a few lines and try it out.", 
  19                 "It uses Windows-style key commands that can be overridden by subclassing.", 
  20                 "Mouse select works. Here are the key commands:", 
  22                 "Cursor movement:     Arrow keys or mouse", 
  23                 "Beginning of line:   Home", 
  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", 
  35 #---------------------------------------------------------------------- 
  39 The Editor class implements a simple text editor using wxPython.  You 
  40 can create a custom editor by subclassing Editor.  Even though much of 
  41 the editor is implemented in Python, it runs surprisingly smoothly on 
  42 normal hardware with small files. 
  46 The demo code (demo/Editor.py) shows how to use Editor 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. 
  50 The samples/FrogEdit directory has an example of a simple text editor 
  51 application that uses the Editor component. 
  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 
  65 if __name__ 
== '__main__': 
  68     run
.main(['', os
.path
.basename(sys
.argv
[0])])