如何在 Python 中隐藏海龟图标/指针
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32804572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to hide a turtle icon/pointer in Python
提问by Bryant
When using Python Turtle, how do you hide turtle icon(s)/pointer(s) in turtle graphics in Turtle code so that it won't show when testing?
使用 Python Turtle 时,如何在 Turtle 代码中隐藏海龟图形中的海龟图标/指针,以便在测试时不显示?
回答by Peter Wood
The documentationhas a section on Visibility:
该文档有一个关于Visibility的部分:
turtle.hideturtle()
turtle.ht()
Make the turtle invisible. It's a good idea to do this while you're in the middle of doing some complex drawing, because hiding the turtle speeds up the drawing observably.
turtle.hideturtle()
turtle.ht()
使乌龟隐形。在您正在进行一些复杂的绘图时这样做是个好主意,因为隐藏海龟可以明显加快绘图速度。
>>> turtle.hideturtle()
Also, you can un-hide the turtle:
此外,您可以取消隐藏海龟:
turtle.showturtle()
turtle.st()
Make the turtle visible.
turtle.showturtle()
turtle.st()
使乌龟可见。
>>> turtle.showturtle()
You can also query its visibilty:
您还可以查询其可见性:
turtle.isvisible()
ReturnTrue
if the Turtle is shown,False
if it's hidden.
turtle.isvisible()
True
如果 Turtle 显示,False
则 返回,如果它是隐藏的。
>>> turtle.hideturtle()
>>> turtle.isvisible()
False
>>> turtle.showturtle()
>>> turtle.isvisible()
True