Unregister operations and revert redirection created by .__init__.
(self)
| 51 | return f"{self.__class__.__name__,}({w.__class__.__name__}<{w._w}>)" |
| 52 | |
| 53 | def close(self): |
| 54 | "Unregister operations and revert redirection created by .__init__." |
| 55 | for operation in list(self._operations): |
| 56 | self.unregister(operation) |
| 57 | widget = self.widget |
| 58 | tk = widget.tk |
| 59 | w = widget._w |
| 60 | # Restore the original widget Tcl command. |
| 61 | tk.deletecommand(w) |
| 62 | tk.call("rename", self.orig, w) |
| 63 | del self.widget, self.tk # Should not be needed |
| 64 | # if instance is deleted after close, as in Percolator. |
| 65 | |
| 66 | def register(self, operation, function): |
| 67 | '''Return OriginalCommand(operation) after registering function. |