python turtle教程2

2025-10-20 07:40:54

1、画圆 circle

turtle.circle(radius,angle,step)

radius决定了圆的尺寸

angle决定了圆整体角度

step是画这个圆所有的线段总和,用1则是一笔画成,如果要够圆,理论越大越好,直接推荐不设置这个参数。

python turtle教程2

python turtle教程2

2、画点 dot

turtle.dot(radius,color)

radius决定了点的尺寸

color决定了点的填充颜色

不给参数与当前画笔的尺寸大小,颜色有关

python turtle教程2

3、刻印 stamp

turtle.stamp()

将当前箭头刻印在画布上

函数返回刻印的id

python turtle教程2

4、消除刻印 clearstamp

turtle.clearstamp(id)

消除id为id的刻印

python turtle教程2

5、消除成组刻印 clearstamps

turtle.clearstamps(2)#消除前2个刻印

turtle.clearstamps(-2)#消除后2个刻印

turtle.clearstamps()#消除所有刻印

python turtle教程2

6、撤销操作 undo

turtle.undo()

undo只对移动有效,刻印什么的无法恢复

python turtle教程2

7、设置移动速度 speed

turtle.speed()返回当前画笔的移动速度

turtle.speed(x)#更改速度为x

python turtle教程2

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢