Reputation: 1843
I am making a program where it takes in the mouse coordinates using pymouse and then makes a dot on that point using turtle.
However the turtle coordinate system and the pymouse coordinate system are quite different: in turtle coordinate system left is 0 and right is 1920(for me) and top is 0 and and bottom is 1040(for me) but in the turtle coordinate system the left is -480, right is 480 and center is 0 and top is 400, bottom is -400 and center is 0.
I use python 3.6.2 and my operating system is Windows 10 32 Bit
How can i convert FROM mouse TO turtle coordinates?
Upvotes: 2
Views: 371
Reputation: 41872
It might be simplest to bend turtle's coordinate system to match pymouse:
from turtle import Turtle, Screen
screen = Screen()
screen.setup(1920, 1040)
screen.setworldcoordinates(0, 1040, 1920, 0)
yertle = Turtle(visible=False)
yertle.dot(5, 'red') # starts life at (0, 0)
screen.exitonclick()
Upvotes: 1