1.turtle库
1.turtle库
导入模块
格式:import 模块名 as 别名
import turtle as t
turtle库函数
| 1.turtle库函数名 | 使用方式 | 注意事项 |
|---|---|---|
| forward()或fd() | turtle.fd(长度) | 直走 |
| backward或bk() | turtle.bk(长度) | 后退 |
| left() | turtle.left(度数) | 左转 |
| right() | turtle.right | 右转 |
| done() | turtle.done() | 写在最后,让画图界面长时间存在 |
| circle() | turtle.circle(圆的半径,圆心角) | 绘制圆 |
| goto() | turtle.goto(x,y) | 移道指定坐标 |
| penup() | turtle.penup() | 抬笔 |
| pendown() | turtle,pendown() | 落笔 |
| fillcolor() | turtle.fillcolor('颜色名') | 设置颜色 |
| begin_fill() | turtle.begin_fill() | 开始填充 |
| end_fill() | turtle.end_fill() | 结束填充 |
| colormode() | RGB整数模式,使用三原色前必须写这一行 | |
| color() | turtle.color(pencolor,fillcolor) | 同时设置笔的颜色和填充颜色 |
浙公网安备 33010602011771号