Undo class

John J. Lee jjl at pobox.com
Mon Nov 10 23:53:08 CET 2003


David Eppstein <eppstein at ics.uci.edu> writes:

> In article <boobnq$69d$1 at news-reader3.wanadoo.fr>,
>  Eric Brunel <eric.brunel at pragmadev.N0SP4M.com> wrote:
> 
> > > 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
[...]
> Take a look at the Cocoa UndoManager functionality.
> Basically, while you're handle a change to a UI object, you call
>     U = undoManager.prepareWithInvocationTarget(self)
>     U.methods(arguments...)
> where self.methods(arguments...) would be the calls you'd do
> to reverse the change, and it saves the method names and arguments for 
> you. Later, when an undo is requested, it performs the calls you 
> prototyped for it.  Very convenient, shouldn't be too hard to program in 
> Python directly (in fact it is available in Python on OS X now, via 
> PyObj).
[...]

Another Undo API that does things in just the same way (pure Python,
with docs!):

http://sketch.sourceforge.net/Doc/devguide-19.html


While you're at it, you could do a lot worse than pinching his GUI
component publisher / subscriber code.


John




More information about the Python-list mailing list