title: Draw a box if perimeter of the box in the image is clicked
body: <p>My GUI is a slideshow of images. If the user clicks anywhere within the square that is already defined in another csv by it's left, top, right, and bottom coordinates, then a green box will show up. The yellow boxes are already present on the image and the user can click anywhere inside any yellow box for the green box to display. I currently have some images where the areas of two squares overlap. I would like to change it so that the user has to click on the border of the square in order for it to show up. I am having difficulty conceptualizing how I would change the:</p>
  <pre><code>    if t &lt;= y &lt;= b and l &lt;= x &lt;= r:
  </code></pre>
  <p>because that's where I think the change is needed.</p>
  <p><a href="https://i.stack.imgur.com/HGiBy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HGiBy.jpg" alt="" /></a></p>
  <pre><code>    def clicked_evt(self, evt):
          x, y = evt.x, evt.y
          #the x,y coordinates of the user click
  
          # this is to retrieve the image from the csv
          image_row = self.get_current_image_row()
          file_name = image_row[CSV_IMAGE_NAME]
          image_data = self.loaded_images[file_name]
  
          for shape in image_data[&quot;shapes&quot;]:
              # these are the coordinates of the correct boxes 
              l = int(shape[&quot;left&quot;])
              t = int(shape[&quot;top&quot;])
              r = int(shape[&quot;right&quot;])
              b = int(shape[&quot;bottom&quot;]) 
              if t &lt;= y &lt;= b and l &lt;= x &lt;= r:
              # if the mouse-click is within the boundaries
                  # Draw the bounding box
                  self.canvas.create_rectangle(l, t, r, b, tag=&quot;box&quot;, outline=&quot;green&quot;, )
                  self.canvas.pack(expand=1)
  </code></pre>