简体   繁体   中英

Python - How to make turtle go to (x,y) position without having it move across the screen?

I want to know how to make Turtle go to an (x, y) coordinate without having it move across the screen. I tried the .goto() and .setposition() methods, but they both make the turtle move across the screen. How do I do this?

You can use pen up, then set the turtle invisible, then use goto to move the turtle to your position.

turtle.up()
turtle.ht()
turtle.goto(x, y)

# reshow the turtle
turtle.st()
turtle.down()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM