How do I set the startpos (topleft of my turtle square) when starting my code?
And I don\'t mean that it starts from the middle and then goes to that position.
Just translate your co-ordinate system to that of the turtle. Say you want to start in the top left of the square - lets call that (0, 10) for arguments sake.
Now, whenever you need to specify a co-ordinate for the turtle, just translate it!
my_start = (0, 10)
If you want to move to (10, 10)
- the top right corner, just provide the new co-ordinates:
>>> new_position = (10 - my_start[0], 10 - my_start[1])
>>> new_position
(10, 0)
(10, 0)
is to the East of the turtle - in the turtle's co-ordinate system, but for you it's (10, 10)
the top right! Everyone wins!
You could just do
turtle.penup()
turtle.setx(my_start[0])
turtle.sety(my_start[1])
turtle.pendown()
but that's not nearly as fun :(