[pygtk] Undo and Redo

David M. Cook dave at davidcook.org
Sun Sep 4 20:47:31 WST 2005

On Sun, Sep 04, 2005 at 09:51:11AM +0200, N. Volbers wrote:

> Look at "Documentation" and then at the "Developer's Guide".  This is a
> very nice introduction to an undo mechanism that basically works like
> this:  If you call an undoable function, then it must return an
> undo-tuple which contains the name of a function f and the appropriate
> arguments x,y,..., so that f(x,y,...) will undo the last action.  This
> will also enable you to offer a "redo" mechanism for free!

This seems more Pythonic to me than the Java-ish Action base class method.
If you wanted to get fancy, you could use a decorator, so you just decorate
the methods you want un/redoable.

Dave Cook

More information about the pygtk mailing list