Home > Net >  How can I add a number to the x or y coordinate of the Turtle Pen? [PYTHON]
How can I add a number to the x or y coordinate of the Turtle Pen? [PYTHON]

Time:11-17

I need to be able to move the turtle cursor to its current coordinates 10y.

For example, if the turtle is at (0.00,0.00) I would need it to read its own coordinates and add 10 to the y value making it (0.00,10.00).

I already know how to find the Turtle's current position with turtle.pos() but how would I add an integer onto any given axis?

CodePudding user response:

Wait nevermind I just found out I can use xcor() and ycor() with setx() and sety()

example:

current_y = t.ycor()
t.sety(current_y   10)

this moves the cursor 10 up from its current position

CodePudding user response:

Use turtle.setpos(), Here is The Documentation from GeeksOfGeeks, Here

Full Guide!

  • Related