Python - 如何让海龟移动到 (x,y) 位置而不让它在屏幕上移动?
Python - How to make turtle go to (x,y) position without having it move across the screen?
我想知道如何使 Turtle
转到 (x, y) 坐标而不让它在屏幕上移动。我尝试了 .goto()
和 .setposition()
方法,但它们都使乌龟在屏幕上移动。我该怎么做?
你可以使用 pen up,然后设置海龟不可见,然后使用 goto 将海龟移动到你的位置。
turtle.up()
turtle.ht()
turtle.goto(x, y)
# reshow the turtle
turtle.st()
turtle.down()
我想知道如何使 Turtle
转到 (x, y) 坐标而不让它在屏幕上移动。我尝试了 .goto()
和 .setposition()
方法,但它们都使乌龟在屏幕上移动。我该怎么做?
你可以使用 pen up,然后设置海龟不可见,然后使用 goto 将海龟移动到你的位置。
turtle.up()
turtle.ht()
turtle.goto(x, y)
# reshow the turtle
turtle.st()
turtle.down()