用pythonturtle画一个美国队长的盾
时间: 2023-11-03 17:06:10 浏览: 112
用Python绘制美国队长盾牌
5星 · 资源好评率100%
好的,以下是绘制美国队长盾牌的Python代码:
```python
import turtle
# 设置画布大小和背景颜色
turtle.setup(800, 800)
turtle.bgcolor("white")
# 绘制外圆
turtle.speed(0)
turtle.penup()
turtle.goto(0, -300)
turtle.pendown()
turtle.color("blue")
turtle.begin_fill()
turtle.circle(300)
turtle.end_fill()
# 绘制红色和白色的条纹
turtle.color("red", "white")
turtle.penup()
turtle.goto(0, 240)
turtle.pendown()
turtle.begin_fill()
turtle.circle(240, 180)
turtle.circle(-240, 180)
turtle.end_fill()
# 绘制内圆
turtle.color("blue")
turtle.penup()
turtle.goto(0, -200)
turtle.pendown()
turtle.begin_fill()
turtle.circle(200)
turtle.end_fill()
# 绘制星星
turtle.color("white")
turtle.penup()
turtle.goto(0, 110)
turtle.pendown()
for i in range(5):
turtle.forward(70)
turtle.right(144)
turtle.penup()
turtle.goto(0, 60)
turtle.pendown()
for i in range(5):
turtle.forward(40)
turtle.right(144)
# 隐藏画笔
turtle.hideturtle()
turtle.done()
```
运行以上代码,你就可以在turtle画布上看到绘制出来的美国队长盾牌了。
阅读全文