drawing with the mouse with turtle...solved?
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sat Nov 13 18:09:18 EST 2010
On Sat, 13 Nov 2010 09:10:41 -0500, Brian Blais wrote:
> Here is code that "works", with at least one small oddity:
>
> import turtle
>
> def gothere(event):
> turtle.penup()
> turtle.goto(event.x-360,340-event.y)
> turtle.pendown()
>
> def movearound(event):
> turtle.goto(event.x-360,340-event.y)
[...]
> the oddity is that the coordinate transformations, x-360 and 340-y, are
> done by eye and do not seem to be related to any of the coordinate
> values I could find. my screen size is 300x400, the x and y canvas
> scales are 1 and 1, but if I try to transform with those numbers the
> mouse is clearly off.
Have you set the coordinates of the screen?
screen.setworldcoordinates
What do turtle.window_height() and turtle.window_width() return?
--
Steven
More information about the Python-list
mailing list