'Unregister operations and revert redirection created by .__init__.'

def close(self):

    for operation in list(self._operations):
        self.unregister(operation)
    widget = self.widget
    tk = widget.tk
    w = widget._w
    tk.deletecommand(w)
    tk.call('rename', self.orig, w)
    del self.widget, self.tk
