title: How do I get mouse position with tkinter and turtle?
body: <p>I am trying to make a program that lets me draw on a tkinter window using turtle. For some reason I cannot get the absolute mouse coordinates.</p>
  
  <p>I have done <code>root.winfo_pointerx() - root.winfo_rootx()</code> (and <code>vrootx</code>). 
  I have also tried:</p>
  
  <pre><code>def mousePos(event):
       x,y = event.x , event.y
       return x,y
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>import turtle
  import tkinter as tk
  root = tk.Tk()
  root.title("Draw!")
  cv = tk.Canvas(root, width=500,height=500)
  cv.focus_set()
  cv.pack(side = tk.LEFT)
  pen = turtle.RawTurtle(cv)
  window = pen.getscreen()
  
  def main():
      window.setworldcoordinates(-500,-500,500,500)
      window.bgcolor("white")
      frame = tk.Frame(root)
      frame.pack(side = tk.RIGHT,fill=tk.BOTH)
      pointLabel = tk.Label(frame,text="Width")
      pointLabel.pack()
      def getPosition(event):
         x = root.winfo_pointerx()-root.winfo_vrootx()
         y = root.winfo_pointery()-root.winfo_vrooty()
         pen.goto(x,y)
      cv.bind("&lt;Motion&gt;", getPosition)
      cv.pack
      tk.mainloop()
      pass
  </code></pre>
  
  <p>I want the cursor to be on top of the arrow, but instead it is always to the right and down. Also, when I move the mouse up, the arrow moves down, and vice versa.</p>