Answers for "how to get position of turtle"

2

get position of turtle python

import turtle
t = turtle.Turtle()

turtles_position = t.pos() # Will return a tuple that includes both X and Y
# coordinates of the turtle named t respectively, E.G (200,600).

turtles_positionX = t.xcor() # Will return a float value of the turtle's
# X position.

turtles_positionY = t.ycor() # Will return a float value of the turtle's
# Y position.

###############################################################
# Make sure to round the last 2 method's numbers as without   #
# rounding you can get numbers like 299.99999999999994.       #
# (You can round with the round(integer) function)			  #
###############################################################
Posted by: Guest on September-13-2021
0

get turtle pos

turtle.pos()
Posted by: Guest on August-23-2021

Code answers related to "how to get position of turtle"

Python Answers by Framework

Browse Popular Code Answers by Language