title: Distance between two objects
body: <p>So I've been trying to figure out how to find the distance between two objects on a canvas and I've exhausted most relevant links on Google with little success.</p>
  
  <p>I'm trying to make it so that it calculates the distance between the drawn ovals and the line on the canvas.</p>
  
  <pre><code>from __future__ import division
  from Tkinter import *
  import tkMessageBox
  
  class MyApp(object):
      def __init__(self):
          self.root = Tk()
          self.root.wm_title("Escape")
          self.canvas = Canvas(self.root, width=800, height=800, bg='white')
          self.canvas.pack()
          self.canvas.create_line(100, 100, 200, 200, fill='black')
          self.canvas.bind("&lt;B1-Motion&gt;", self.tracer)
          self.root.mainloop()
  
      def tracer(self, e):
          self.canvas.create_oval(e.x-5, e.y-5, e.x+5, e.y+5, fill='blue', outline='blue')
          rx = "%d" % (e.x)
          ry = "%d" % (e.y)
          print rx, ry
  MyApp()
  </code></pre>