B
Brian Blais
I'd like to draw on a turtle canvas, but use the mouse to direct the turtle. I don't see a good way of getting the mouse coordinates and the button state. I tried to do something like this:
import turtle
def gothere(event):
print event.x
print event.y
turtle.goto(event.x,event.y)
turtle.reset()
turtle.speed(0)
c=turtle.getcanvas()
c.bind("<Button-1>", gothere)
turtle.pendown()
but this seemed to draw in the wrong place (like the coordinates were wrong). Is there a good way to do this?
thanks,
bb
import turtle
def gothere(event):
print event.x
print event.y
turtle.goto(event.x,event.y)
turtle.reset()
turtle.speed(0)
c=turtle.getcanvas()
c.bind("<Button-1>", gothere)
turtle.pendown()
but this seemed to draw in the wrong place (like the coordinates were wrong). Is there a good way to do this?
thanks,
bb