How it works...

While the bind() method is used to register handlers for widget events, the protocol method does the same for window manager protocols.

The WM_DELETE_WINDOW handler is called when a top-level window is about to be closed, and, by default, Tk destroys the window for which it was received. Since we are overriding this behavior by registering the confirm_delete handler, it needs to explicitly destroy the window if the dialog is confirmed.

Another useful protocol is WM_TAKE_FOCUS, which is called when a window takes the focus.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset