turtle.shape(名称=无)
参数
name - 一个有效的shapename字符串
将乌龟形状设置为具有给定名称的形状,或者,如果未给出名称,则返回当前形状的名称。带有名称的形状必须存在于TurtleScreen的形状字典中。最初有以下多边形形状:“箭头”,“乌龟”,“圆圈”,“方形”,“三角形”,“经典”。要了解如何处理形状,请参阅屏幕方法register_shape()。
turtle.shape()
‘classic’turtle.shape(“turtle”)
turtle.shape()
‘turtle’
turtle.resizemode(rmode = None )
参数
rmode - 其中一个字符串“auto”,“user”,“noresize”
将resizemode设置为以下值之一:“auto”,“user”,“noresize”。如果RMODE 没有给出,返回当前resizemode。不同的resizemodes具有以下效果:
“auto”:调整对应于pensize值的乌龟的外观。
“user”:根据stretchfactor和outlinewidth(outline)的值来调整乌龟的外观 shapesize()。
“noresize”:没有适应乌龟的外观。
shapesize()与参数一起使用时调用resizemode(“user”)。
turtle.resizemode()
‘noresize’turtle.resizemode(“auto”)
turtle.resizemode()
‘auto’
turtle.shapesize(stretch_wid = None,stretch_len = None,outline = None )
turtle.turtlesize(stretch_wid = None,stretch_len = None,outline = None )
参数
stretch_wid - 正数
stretch_len - 正数
大纲 - 正数
返回或设置笔的属性x / y-stretchfactors和/或outline。将resizemode设置为“user”。当且仅当resizemode设置为“user”时,乌龟将根据其伸长因子显示拉伸:stretch_wid是stretchfactor垂直于其方向,stretch_len是拉伸因子的方向,outline确定形状轮廓的宽度。
turtle.shapesize()
(1, 1, 1)turtle.resizemode(“user”)
turtle.shapesize(5, 5, 12)
turtle.shapesize()
(5, 5, 12)turtle.shapesize(outline=8)
turtle.shapesize()
(5, 5, 8)