protocol(name=None, func=None)
Registers a callback function for the given protocol. The name argument is typically one of “WM_DELETE_WINDOW” (the window is about to be deleted), “WM_SAVE_YOURSELF” (called by X window managers when the application should save a snapshot of its working set) or “WM_TAKE_FOCUS” (called by X window managers when the application receives focus).
т.е.
root.protocol("WM_DELETE_WINDOW", your_callback)