Python turtle海龟绘制美国队长盾牌

使用Python中的turtle模块绘制美队盾牌

具体思路如下:

  1. 导入海龟库
  2. 第1个圆:半径 200,红色填充
  3. 第2个圆:半径 150,白色填充
  4. 第3个圆:半径 100,红色填充
  5. 第4个圆:半径 50,蓝色填充

代码如下:(仅供参考,如有错误欢迎指正)

python 复制代码
# 导入海龟库
import turtle
t=turtle.Turtle()
t.shape('turtle')
t.speed(0)

# 第一个圆:红色,半径200
t.up()
t.goto(0,-200)
t.down()
t.color('red')
t.begin_fill()
t.circle(200)
t.end_fill()

# 第二个圆:白色,半径150
t.up()
t.goto(0,-150)
t.down()
t.color('white')
t.begin_fill()
t.circle(150)
t.end_fill()

# 第三个圆:红色,半径100
t.up()
t.goto(0,-100)
t.down()
t.color('red')
t.begin_fill()
t.circle(100)
t.end_fill()

# 第四个圆:蓝色,半径50
t.up()
t.goto(0,-50)
t.down()
t.color('blue')
t.begin_fill()
t.circle(50)
t.end_fill()

# 画五角星
t.up()
t.goto(-40,15)
t.down()
t.color('white')
t.begin_fill()
for i in range(5):
    t.forward(80)
    t.right(144)
t.end_fill()

# 海龟隐藏hideturtle、显示show
t.hideturtle()
t.hideturtle()

运行效果

相关推荐
小羊没烦恼!7 分钟前
关于大型asp.net应用系统的架构-架构的选择
java·服务器·开发语言·前端·c#
小羊没烦恼!17 分钟前
Windows Azure Platform体验(1):Windows Azure
java·大数据·后端·python·flask·word·.net
夏幻灵18 分钟前
前端八股:JavaScript 深拷贝详解:实现方式、递归原理与循环引用
开发语言·前端·javascript
JWASX21 分钟前
【agent 开发】agent 开发学习 - LangChain(1)
python·学习·agent
jason.zeng@150220726 分钟前
(五)多轮对话上下文,实现交互。
python·交互·llama
wangchunyu11427 分钟前
食韵味简 —— 免费开源的中式菜谱 API 服务
python·django·开源
znx93927 分钟前
因子分析:量化交易的底层核心与盈利逻辑基石
人工智能·python·机器学习·期魔方
jason.zeng@150220732 分钟前
(十)分层架构的多文件工程
python·架构·prompt·交互·ai编程·llama
小小张说故事33 分钟前
Python 装饰器到底是个啥?从 @ 符号到手写一个,5 个例子讲透
后端·python
傲世仙尊34 分钟前
C++起步-命名空间解决命名冲突与cin-cout缺省参数
开发语言·c++