自学python 实例1 绘制老蛇

#python 绘制老蛇
import turtle
turtle.setup(650,350,200,200)
turtle.penup()
turtle.fd(-250)
turtle.pendown()
turtle.pensize(25)
turtle.pencolor(“red”)
turtle.seth(-40)
for i in range(4):
turtle.circle(40,80)
turtle.circle(-40,80)
turtle.circle(40,80/2)
turtle.fd(40)
turtle.circle(16,180)
turtle.fd(40*2/3)
turtle.done()

‘’‘调用库,import turtle
设置窗体布局,turtle.setup()
turtle.fd()往右走
turtle.bk()往左走
turtle.left(angle)往上(度)
turtle.right(angle)往下(度)
turtle.seth(-40) 改变方向
turtle.circle(半径,角度)曲线
画笔控制
turtle.penup()抬起画笔
turtle.pendown()落下画笔
turtle.pensize(25)画笔宽度
turtle.width(25)画笔宽度
turtle.pencolor(“red”)颜色
turtle.done()运行完后窗体不关闭
‘’’

你可能感兴趣的:(pb)