title: Python tkinter: Handling ButtonPress Events differently on/off buttons
body: <p><strong>Question:</strong> It seems that ButtonPress events on tkinter give the location of the click w/r to the top left corner of the window. However, when you click on a Button widget, a ButtonPress event occurs, but the x,y location values given are w/r to the top left corner of the Button. How can I get the ButtonPress event to occur at the location w/r to the top left corner of the window, not the button?</p>
  <p><strong>Details:</strong> I have a tkinter program that lets users draw on a picture (layout below), but only occurs below a certain <code>y</code> value. If you move the cursor below that threshold (aka below the picture and into an area that has instructions), no drawing functionality can occur. Drawing only occurs with clicks, so <code>&lt;Button-1&gt;</code> is bound to a class method that keeps track of where the click occurred and draws on the picture at that location:</p>
  <p><code>self.root.bind('&lt;Button-1&gt;', self.addDot)</code></p>
  <p>However, in the area that has instructions, there is an undo button. Clicking on it in theory should undo the last click's effect. Instead, if I click on it, it registers a <code>&lt;ButtonPress&gt;</code> event that has x and y values with respect to the top left corner of the <em>button</em>, not the <em>window</em>. I do not know how to differentiate when the x,y location of a button press occurs w/r to the window or the button, so the <code>self.addDot</code> function executes near the top left of the image. Everywhere else you click behaves as normal.</p>
  <p><strong>One caveat</strong> I have seen is that if I change the binding to be on the canvas, not the root, this strangely goes away and behaves as expected. Why is that?</p>
  <p><strong>Layout:</strong></p>
  <p><a href="https://i.stack.imgur.com/h2WbY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h2WbY.png" alt="Layout of screen" /></a></p>