python中的Turtle模块

一:笔绘制图形状态的方法

turtle.pendown()  移动的时候绘制

turtle.penup()      移动的时候不绘制

turtle.pensize()    将线的粗细设定为指定宽度

二:Turtle运动的方向

turtle.forward(d)    移动方向前移指定距离

turtle.backward(d) 移动方向反向移动指定距离

turtle.left(angle)     左转指定角度

turtle.right(angle)   右转指定角度

turrle.goto(x,y)       移动到一个绝对位置

turtle.setx(x)          将x坐标移动到指定位置

turtle.sety(y)           将y坐标移动到指定位置

turtle.setheading(angle)    将移动方向设置指定角度(0-东,90-北,180-西,270-南)

turtle.home()                    移动到起点(0,0)向东

turtle.circle(r,ext,step)       指定半径,范围和阶数的圆

turtle.dot(diameter,color)    绘制一个指定直径和颜色的圆

turtle.undo()                      取消最后一个操作

turtle.speed(s)                   设置turtle的移动速度

猜你喜欢

转载自www.cnblogs.com/dudu1992/p/9430904.html
今日推荐