taleinat at gmail.com
Thu Feb 1 23:22:51 CET 2007
I've recently checked out ways to have IDLE do something upon closing a
window. Turns out the there is a beginning of such a mechanism in
EditorWindow: the set_close_hook method. However, this method simply sets
the instance's close_hook attribute, which means that setting it again will
override the original hook. Specifically, EditorWindow sets the close_hook
to FileList.close_edit(self), which removes the window from the FileList.
This means that overriding the close_hook could (and would) cause bugs (in
The simplest solution AFAIK is to have a list of hooks and allow adding and
removing hooks. Upon closing, the hooks are called in the reverse order of
which they were added (i.e. last added is called first).
Another solution would be to allow setting a new hook, and have a flag
stating whether the old hook should be called after the new one is done.
Obviously more comprehensive solutions exist but I don't think we need
something more complex.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IDLE-dev