小海龟绘图使用命令

turtle模块绘图:

#导入 inport.turtle()

运动命令:
turtle.forward(d) 向前移动D长度
turtle.backward(d) 向后移动D长度
turtle.right(d) 向右转动D度
turtle.left(d) 向左转动D度
turtle.goto(x,y) 移动到坐标为x,y的位置
turtle.speed(speed) 笔画控制的速度[0,10)

笔画控制命令:
turtle.up() 笔画抬起,再移动不会画图
turtle.down() 笔画落下,移动会绘图
turtle.setheading(d) 改变海龟的朝向
turtle.pensize(d) 笔画的宽度
turtle.pencolor(”colorstr“) 笔画的颜色
reset() 恢复所有设置,清空窗口,重置turtle状态
clear() 清空窗口,但不会重置
turtle.circle(r,step=e) 绘制一个圆形,r为半径,e为次数

turtle.begin_fill()
turtle.fillcolor(“colorstr”)
turtle.end_fill()

其他命令:
done():使程序继续执行
import turtle
turtle.done()
undo() 撤销上一次动作
hideturtle() 隐藏小海龟
showturtle() 显示小海龟
screensize(x,y) 屏幕尺寸

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值