title: How to move a rectangle to the mouse position with Tkinter/Python?
body: <p>I'm using Tkinter/Python's Canva class' coord() method to move a rectangle. What should I pass as paramters in order to make it work?</p>
  
  <pre><code>from tkinter import *
  
  root = Tk()
  
  def key(event):
      print ("pressed", repr(event.char))
  
  def callback(event):
      position = (event.x,event.y)
      event.widget.coords(item, position)
  
  canvas= Canvas(root, width=100, height=100)
  canvas.bind("&lt;Key&gt;", key)
  canvas.bind("&lt;Button-1&gt;", callback)
  item = canvas.create_rectangle(10,10,5,5)
  canvas.pack()
  </code></pre>