python绘制出奥特曼

1.源代码

import turtle



def draw_ultraman():

# 设置画笔颜色为红色

turtle.color("red")

# 绘制头部

turtle.begin_fill()

turtle.circle(50)

turtle.end_fill()

# 绘制眼睛

turtle.color("white")

turtle.begin_fill()

turtle.circle(10)

turtle.end_fill()

turtle.color("black")

turtle.begin_fill()

turtle.circle(5)

turtle.end_fill()

turtle.penup()

turtle.goto(25, 0)

turtle.pendown()

turtle.begin_fill()

turtle.circle(5)

turtle.end_fill()

# 绘制身体

turtle.color("red")

turtle.penup()

turtle.goto(-25, -50)

turtle.pendown()

turtle.begin_fill()

turtle.forward(50)

turtle.right(90)

turtle.forward(100)

turtle.right(90)

turtle.forward(50)

turtle.right(90)

turtle.forward(100)

turtle.end_fill()

# 绘制腿部

turtle.penup()

turtle.goto(-25, -150)

turtle.pendown()

turtle.right(45)

turtle.forward(70)

turtle.right(90)

turtle.forward(70)

turtle.penup()

turtle.goto(25, -150)

turtle.pendown()

turtle.left(90)

turtle.forward(70)

turtle.left(90)

turtle.forward(70)

# 隐藏画笔

turtle.hideturtle()

turtle.done()

你可能感兴趣的:(python,开发语言)