turtle库是Python语言中一个很流行的绘制图像的函数库,在一个横轴为x、纵轴为y的坐标系原点,(0,0)位置开始,它根据一组函数指令的控制,在这个平面坐标系中移动,从而在它爬行的路径上绘制了图形。
1、画安卓小人
有些画偏了。
import turtle
aj = turtle.Pen()
y = 0
aj.speed(5)
#turtle.screensize(200,800)
turtle.bgcolor("black")
#aj.shape("turtle")
def head():
aj.color("green")
aj.fd(160)
x = aj.xcor()
aj.seth(90)
aj.begin_fill()
#aj.color("green")
aj.circle(x/2, 180)
aj.end_fill()
aj.penup()
aj.goto(33, 37)
aj.pendown()
aj.dot(13, "black")
aj.penup()
aj.goto(126, 37)
aj.pendown()
aj.dot(13, "black")
aj.penup()
aj.home()
aj.pendown()
aj.hideturtle()
aj.fd(160)
aj.seth(90)
aj.circle(x/2, 60)
aj.right(90)
aj.pensize(5)
aj.fd(30)
aj.penup()
aj.home()
#aj.pendown()
aj.hideturtle()
aj.fd(160)
aj.seth(90)
aj.circle