turtle库学习笔记

1.turtle 画笔控制

   turtle.penup() 别名turtle.pu()                            抬起画笔

   turtle.pendown()别名turtle.pd()                         落下画笔

   turtle.pensize(width)别名turtle.width(width)      画笔宽度

    turtle.pencolor(color)                                        画笔颜色

     注:color的三种形式

             颜色字符形:turtle.pencolor("purple")

              RGB的小数值:turtle.pencolor(0.63,0.13,0.94)

              RGB的元组值:turtle.pencolor((0.63,0.13,0.94))

2.turtle 运动控制

    turtle.forward(d)别名turtle.fd(d)     画笔走直线     (d为行走距离)

    turtle.circle(r,extent)                   画笔走曲线      (圆心为左侧距离r处,extent为绘制角度)

3.turtle 方向控制

    turtle.setheading(angle)别名turtle.seth(angle)

    turtle.left(angle)

    turtle.right(angle)

 

posted @ 2020-03-15 18:22  xieyvhua  阅读(278)  评论(0)    收藏  举报