在Windows系统下用python编写一个的程序:用turtle库画出电影“加勒比海盗”里的Jack Sparrow
时间: 2023-06-19 16:03:03 浏览: 88
以下是使用turtle库在Windows系统下编写的程序,可以画出电影“加勒比海盗”里的Jack Sparrow:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 600)
turtle.bgcolor("#5c8d89")
# 画Jack Sparrow的帽子
turtle.penup()
turtle.goto(-80, 100)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(70, 200)
turtle.goto(80, 100)
turtle.circle(-70, 200)
turtle.goto(-80, 100)
turtle.end_fill()
# 画Jack Sparrow的脸
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.fillcolor("#f5c18f")
turtle.begin_fill()
turtle.circle(100)
turtle.end_fill()
# 画Jack Sparrow的眼睛
turtle.penup()
turtle.goto(-30, 30)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
turtle.penup()
turtle.goto(30, 30)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(20)
turtle.end_fill()
# 画Jack Sparrow的鼻子
turtle.penup()
turtle.goto(0, 0)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(10)
turtle.end_fill()
# 画Jack Sparrow的嘴巴
turtle.penup()
turtle.goto(-20, -30)
turtle.pendown()
turtle.fillcolor("#e67e22")
turtle.begin_fill()
turtle.circle(20, 180)
turtle.end_fill()
# 画Jack Sparrow的耳朵
turtle.penup()
turtle.goto(-100, 0)
turtle.pendown()
turtle.fillcolor("#f5c18f")
turtle.begin_fill()
turtle.circle(25)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 0)
turtle.pendown()
turtle.fillcolor("#f5c18f")
turtle.begin_fill()
turtle.circle(-25)
turtle.end_fill()
# 画Jack Sparrow的头发
turtle.penup()
turtle.goto(-100, 120)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(30, 150)
turtle.goto(-80, 120)
turtle.goto(-80, 100)
turtle.goto(-100, 100)
turtle.goto(-100, 120)
turtle.end_fill()
turtle.penup()
turtle.goto(-80, 120)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(-30, -150)
turtle.goto(-100, 120)
turtle.end_fill()
turtle.penup()
turtle.goto(100, 120)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(-30, -150)
turtle.goto(80, 120)
turtle.goto(80, 100)
turtle.goto(100, 100)
turtle.goto(100, 120)
turtle.end_fill()
turtle.penup()
turtle.goto(80, 120)
turtle.pendown()
turtle.fillcolor("#3d3d3d")
turtle.begin_fill()
turtle.circle(30, 150)
turtle.goto(100, 120)
turtle.end_fill()
# 隐藏画笔
turtle.hideturtle()
# 点击关闭窗口
turtle.exitonclick()
```
运行程序后,将会弹出一个窗口,显示出电影“加勒比海盗”里的Jack Sparrow的图像。
阅读全文