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()

运行效果

相关推荐
郝学胜_神的一滴4 分钟前
Python 高级编程 027:四大推导式全攻略
python·pycharm
菜冻鱼14 分钟前
Python-sklearn-特征工程
开发语言·人工智能·python·机器学习·numpy·matplotlib·sklearn
mit6.82423 分钟前
archived
后端·python·flask
船长@25 分钟前
FastAPI 快速上手:从零基础到实操入门
python·ai·fastapi
吴声子夜歌35 分钟前
正则指引——PHP
开发语言·正则表达式·php
Claire_881 小时前
企业文件管理系统选型技术框架与主流产品对比分析
开发语言·php
(Charon)1 小时前
【C++】:使用 mutex + deque 实现一个简单的 LockedQueue
开发语言·c++
我要两颗404西柚1 小时前
2【python】:常用关键字,函数,方法
python
qingyunliushuiyu1 小时前
制造行业智能问数工具怎么选?2026年选型核心要点梳理
大数据·人工智能·经验分享·制造
COOLMO研究AI1 小时前
Python 如何给 AI API 实现断路器模式:防止雪崩与保护本地服务
人工智能·python·php