title: Overriding Tkinter "X" button control (the button that close the window)
body: <p>When the user presses a <em>close</em> <code>Button</code> that I created, some tasks are performed before exiting. However, if the user clicks on the <code>[X]</code> button in the top-right of the window to close the window, I cannot perform these tasks. </p>
  
  <p>How can I override what happens when the user clicks <code>[X]</code> button?</p>