操纵海龟绘图有着许多的命令,这些命令可以划分为两种:一种为运动命令,一种为画笔控制命令
(1)运动命令:
forward(d) 向前移动距离d代表距离
backward(d) 向后移动距离d代表距离
right(degree) 向右转动多少度
left(degree) 向左转动多少度
goto(x,y) 将画笔移动到坐标为(x,y)的位置
stamp() 绘制当前图形
speed(speed) 画笔绘制的速度范围[0,10]整数
画笔控制命令:
own() 画笔落下,移动时绘制图形
up() 画笔抬起,移动时不绘制图形
setheading(degree) 海龟朝向,degree代表角度
reset() 恢复所有设置
pensize(width) 画笔的宽度
pencolor(colorstring) 画笔的颜色
fillcolor(colorstring) 绘制图形的填充颜色
fill(Ture)
fill(False)
circle(radius, extent)









网友评论