Undo class

Eric Brunel eric.brunel at pragmadev.N0SP4M.com
Mon Nov 10 10:51:26 EST 2003


Mickel Grönroos wrote:
> Hello everybody
> 
> I'm developing a tool in Tkinter and would like to add Undo and Redo
> commands to my Edit menu. Does somebody know if anybody has implemented
> standard Undo/Redo as a Python module? I could not find any info with
> Google on the matter.

On what king of widget? If it's a Text, you can use the native tk undo/redo 
features: create the Text widget with the option undo set to 1, then use the 
methods edit_undo() and edit_redo(). These are tk 8.4 features, so it may not 
work for Python versions older than 2.3 (it doesn't work with 2.1; don't know 
about 2.2)

For other widgets, I doubt there can be a generic mechanism to manage the 
undo/redo functions for you: after all, only you can tell what actions should be 
able to be undone or redone. But I'd be really happy if someone can prove me wrong!

HTH anyway.
-- 
- Eric Brunel <eric dot brunel at pragmadev dot com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com





More information about the Python-list mailing list