I can create a turtle that will be in a window with the following code:
Turtle t1 = new Turtle(w,100,100);
If I want to know its coordinates, I
I have no idea what Turtle class you are using, but I'd imagine you'd do something like this:
int x1 = t1.getX(w);
int x2 = t2.getX(w);
For python turtle module, get the x and y coordinates of the turtle use the getPosition method like this:
import turtle
import time
alex = turtle.Turtle()
alex_text = turtle.Turtle()
alex_text.goto(alex.position()[0], alex.position()[1])
alex_text.write("hello")
time.sleep(1)
turtle.position() - Return the turtle’s current location (x,y) (as a Vec2D vector).
Read more about it here: https://docs.python.org/3.3/library/turtle.html#turtle.write
Use turtle.xcor()
it returns the x position.
Use turtle.ycor()
it returns the y position.