Skip to content
Sign upLog in
← Back to Community

Retrieve Turtle Coordinates

Profile icon
JaiceeSargent

Might be a silly question, but if you have a turtle imported and you've moved it around, is there a command to have the current coordinates of the turtle printed in the portal so that you can use it in the next part of the code? Any and all solutions are greatly appreciated. :)

Voters
Profile icon
Isaacbennett2
Profile icon
kairabanaji
Profile icon
JaiceeSargent
Comments
hotnewtop
Profile icon
RYANTADIPARTHI

You can do this :

import turtle tess=turtle.Turtle() def buttonclick(x,y): print("You clicked at this coordinate({0},{1})".format(x,y)) turtle.onscreenclick(buttonclick,1) turtle.listen() # listen to incoming connections turtle.speed(10) # set the speed turtle.done() Or if you want more info, check this link out: https://www.geeksforgeeks.org/how-to-get-coordinate-of-screen-in-python-turtle/
Profile icon
JaiceeSargent

@RYANTADIPARTHI
thank you so much!

Profile icon
RYANTADIPARTHI

@JaiceeSargent
np, can you mark my answer? Thanks!

Profile icon
Coder100