if you bind this on windowit will be triggered once for each widget in the windowthe callback' event argument widget attribute gives the widget being destroyedand you can check this to detect particular widget' destruction if you bind this on specific widget insteadit will be triggered once for that widget' destruction only it' important to know that widget is in "half deadstate (tk' terminologywhen this event is triggered--it still existsbut most operations on it fail because of thatthe event is not intended for gui activity in generalfor instancechecking text widget' changed state or fetching its content in handler can both fail with exceptions in additionthis event' handler cannot cancel the destruction in general and resume the guiif you wish to intercept and verify or suppress window closes when user clicks on window' buttonuse wm_delete_window in top-level windowsprotocol methods as described earlier in this you should also know that running tkinter widget' quit method does not trigger any events on exitand even leads to fatal python error on program exit in if any event handlers are registered because of thisprograms that bind this event for non-gui window exit actions should usually call destroy instead of quit to closeand rely on the fact that program exits when the last remaining or only tk root window (default or explicitis destroyed as described earlier this precludes using quit for immediate shutdownsthough you can still run sys exit for brute-force exits script can also perform program exit actions in code run after the mainloop call returnsbut the gui is gone completely at this pointand this code is not associated with any particular widget watch for more on this event when we study the pyedit example program in at the risk of spoiling the end of this storywe'll find it unusable for verifying changed text saves message and entry the message and entry widgets allow for display and input of simple text both are essentially functional subsets of the text widget we'll meet latertext can do everything message and entry canbut not vice versa message the message widget is simply place to display text although the standard showinfo dialog we met earlier is perhaps better way to display pop-up messagesmessage splits up long strings automatically and flexibly and can be embedded inside container widgets any time you need to add some read-only text to display moreoverthis widget sports more than dozen configuration options that let you customize its appearance example - and figure - illustrate message basicsand demonstrates how message reacts to horizontal stretching with fill and expandsee for more on resizing and tk or tkinter references for other options message supports tkinter tourpart