当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python turtle.showturtle()用法及代码示例


turtle 模块以面向对象和面向过程的方式提供 turtle 图形基元。由于它使用Tkinter作为基础图形,因此需要安装有Tk支持的Python版本。

turtle .showturtle()

此方法用于使 turtle 可见。它不需要任何参数。

用法:

turtle.showturtle() 
or 
turtle.st()

下面是上述方法的实现示例:

例:



Python3

# import package 
import turtle 
  
# set speed to slowest for 
# better understandings 
turtle.speed(1) 
  
# motion 
turtle.forward(100) 
turtle.right(90) 
  
# hide the turtle 
turtle.hideturtle() 
  
# motion 
turtle.forward(100) 
turtle.right(90) 
turtle.forward(100) 
turtle.right(90) 
  
# show the turtle 
turtle.showturtle() 
  
# motion 
turtle.forward(100) 
turtle.right(90)

输出:

相关用法


注:本文由纯净天空筛选整理自deepanshu_rustagi大神的英文原创作品 turtle.showturtle() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。