Turtle笔记+一只发条人

      turtle.penup()别名turtle.pu():拾起画笔

      turtle.pendown()别名turtle.pd():放下画笔,

      turtle.color(color1, color2):同时设置pencolor=color1, fillcolor=color2。

      turtle.pencolor(color)  有三种方式:

                                          turtle.pencolor(‘purple’) 

                                           turtle.pencolor(255,255,255)

                                           turtle.pencolor(1,1,1) 

       turtle.fillcolor(colorstring):绘制图形的填充颜色

       turtle.home():设置当前画笔位置为原点,朝向东。

       turtle.dot(r):绘制一个指定直径和颜色的圆点。

       turtle.begin_fill():准备开始填充图形。

       turtle.end_fill():填充完成。

       turtle.hideturtle():隐藏画笔的turtle形状。

       turtle.showturtle():显示画笔的turtle形状

       turtle.forward(distance)(别名:turtle.fd):向当前画笔方向移动distance像素长度。

       turtle.backward(distance):向当前画笔相反方向移动distance像素长度。注意转向不变

       turtle.right(angle):顺时针移动angle

        turtle.left(angle):逆时针移动angle。

       turtle.circle(radius, extent=None, steps=None




链接:https://www.jianshu.com/p/c59ee2ea6fd2

import turtle

turtle.pencolor("black")
turtle.pensize(3)
turtle.pendown()
turtle.fd(120)
turtle.seth(90)
turtle.fd(80)
turtle.seth(180)
turtle.fd(120)
turtle.seth(-90)
turtle.fd(80)
turtle.penup()
turtle.goto(25,55)
turtle.seth(0)
turtle.pendown()
turtle.fd(25)
turtle.penup()
turtle.fd(20)
turtle.pendown()
turtle.fd(25)
turtle.penup()
turtle.goto(45,20)
turtle.pendown()
turtle.fd(30)
turtle.penup()
turtle.goto(0,0)
turtle.pendown()
turtle.fd(135)
turtle.goto(-15,0)
turtle.seth(-90)
turtle.fd(360)
turtle.seth(0)
turtle.fd(150)
turtle.seth(90)
turtle.fd(360)
turtle.penup()
turtle.goto(60,-360)
turtle.seth(90)
turtle.pendown()
turtle.fd(200)
turtle.seth(0)
turtle.pensize(18)
turtle.fd(75)
turtle.seth(180)
turtle.fd(150)
turtle.penup()
turtle.goto(135,-25)
turtle.seth(0)
turtle.pendown()
turtle.fd(30)
turtle.pensize(2)
turtle.fd(20)
turtle.seth(90)
turtle.fd(20)
turtle.seth(-90)
turtle.fd(40)
turtle.seth(90)
turtle.fd(20)
turtle.seth(0)
turtle.fd(20)
turtle.circle(20,360)
turtle.circle(-20,360)
turtle.penup()
turtle.fd(-280)
turtle.pendown()
turtle.pensize(22)
turtle.fd(60)
turtle.done()

一个很简单的人形图案,是这几天的学习的一点点结果

 仅仅用几种代码即可,大家可多多发挥自己想象力

原文地址:https://www.cnblogs.com/Glzt/p/12489122.html