title: Tkinter drag and drop
body: <p>I'm working on a drag and drop function that will allow me to move items around on a canvas.I have it working (Kind of) but I move only slightly but the line shoots across the screen (And eventually off the visible part of the canvas so I cannot get to it. I'm not sure where to go from here. Below is the drag and drop code I've created so far:</p>
  
  <pre><code>def onPressToMove(self, event): #get initial location of object to be moved
      winX = event.x - self.workspace.canvasx(0)
      winY = event.y - self.workspace.canvasy(0)
      self.dragInfo["Widget"] = self.workspace.find_closest(event.x, event.y, halo = 5)[0]
      self.dragInfo["xCoord"] = winX
      self.dragInfo["yCoord"] = winY
  
  def onReleaseToMove(self, event): #reset data on release
      self.dragInfo["Widget"] = None
      self.dragInfo["xCoord"] = 0
      self.dragInfo["yCoord"] = 0        
  
  def onMovement(self, event):
      winX = event.x - self.workspace.canvasx(0)
      winY = event.y - self.workspace.canvasy(0)
      newX = winX - self.dragInfo["xCoord"]
      newY = winY - self.dragInfo["yCoord"]
      self.workspace.move(self.dragInfo["Widget"], newX, newY)
  </code></pre>
  
  <p>dragInfo is a dictionary I'm using to store the data. Originally I thought that translating the canvas coordinates to window coordinates would help, but it acts the same as without that stuff.</p>