[英]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. 我想知道如何使
Turtle
转到(x,y)坐标而不在屏幕上移动。 I tried the .goto()
and .setposition()
methods, but they both make the turtle move across the screen. 我尝试了
.setposition()
.goto()
和.setposition()
方法,但是它们都使乌龟在屏幕上移动。 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. 您可以使用笔向上,然后将海龟设置为不可见,然后使用goto将海龟移动到您的位置。
turtle.up()
turtle.ht()
turtle.goto(x, y)
# reshow the turtle
turtle.st()
turtle.down()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.