turtle库绘制蟒蛇--python

 
  
import turtle
turtle.setup(650,350,200,200)
#width, height, startx, starty
turtle.penup()
#海龟起飞
turtle.fd(-250)
#fd表示向海龟的正前方向行走,bk表示向后走
turtle.pendown()
#海龟降落
turtle.pensize(25)
#画笔的宽度,海龟的腰围
turtle.pencolor("purple")
turtle.seth(-40)
#改变海龟的行进角度,angle为绝对角度
for i in range(4):
    turtle.circle(40,80)
    #以某个点为圆心转(r,angle)
    turtle.circle(-40,80)
turtle.circle(40,80/2)
turtle.fd(40)
turtle.circle(16,180)
turtle.fd(40 *2/3)
turtle.done()


你可能感兴趣的:(turtle库绘制蟒蛇--python)