Getting Tkinter Text contents before destruction
Fredrik Lundh
fredrik at pythonware.com
Thu Feb 9 09:19:29 EST 2006
Bob Greschke wrote:
> I want to grab the contents of a Text widget when the frame it's on gets destroyed. I tried
> TextWidget.bind("<Destroy>"... , but the widget is gone before the call gets made, and I'd really
> hate to do something with the function that gets called with TextWidgetsFrame.bind("<Destroy>",
> ..., since that one function handles all of the frames in the program...or would that even work?
>
> How can I do this?
in what ways can the frame be destroyed ?
assuming that you're talking about user-initiated actions, the most reasonable way
to do this is to implement a WM_DELETE_WINDOW handler on the toplevel
window that the frame is located in, and deal with the text widget in there. see:
http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols
</F>
More information about the Python-list
mailing list