[Tkinter-discuss] Re: Problem with Text widget's "see" method
fredrik at pythonware.com
Mon Feb 14 19:31:52 CET 2005
Jared Cohen wrote:
> I'm building a text editor that has an Undo/Redo feature. To do this, I basically invoke a
> callback every time the user presses a key; the callback copies the entire contents of the Text
> widget to a history list.
that's a bit more brute-force than it has to be; a better (but less
obvious) way is to "override" the insert and delete commands at
the widget implementation level.
see Lib/idlelib/Percolator.py for a helper class, and sample code
(the actual overriding is done in the WidgetRedirector.py module
in the same directory)
> Of course, the Text widget doesn't actually HAVE a method to explicitly
> set the position of the cursor
the cursor is represented by the INSERT mark, so
possibly followed by
should do the trick.
More information about the Tkinter-discuss