The Tk canvas (and thus the Slate) provides no in-built editing capabilities for text. The Editor interactor encapsulates the code needed by the Slate to support basic interactive editing on text items. Note that this is intended only for editing small items like labels in diagrams.
The Editor interactor has no configuration options not present in its Interactor superclass.
The interactor is attached to one or a set of Slate items with the
bind
command (as usual). Once activated, the insertion
cursor remains in the text item until the stop
method is
called. How this method is called depends on the client -- it will
usually be by the user clicking on a different object. (The
usual click-drag-release sequence is used in this interactor, but
to drag-select text.)
An item which is the target of an editor interactor must respond to
the following methods (see the documentation for the Tk canvas):
dchars
, focus
, icursor
,
index
, insert
, and select
.
While an item has the insertion cursor, the text can be edited as follows:
Enhancements: (i) This interactor should probably be renamed LineEditor. (ii) Double-click and dragging does not quite work: the selection moves from the start of the first selected word, not from the farthest end. (iii) The up and down cursors should be made to work in multi-line items.