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

运行效果

相关推荐
haidao03139 分钟前
氙灯光源技术特性及其在光催化实验中的标准化应用研究
人工智能·python·能源
IT笔记43 分钟前
Rust 迭代器多级链式调用执行顺序笔记
开发语言·笔记·rust
用户0332126663671 小时前
使用 Python 设置 Excel 行列自适应 【代码示例】
python·excel
Ticnix1 小时前
RAG 的坑不在检索,在"对齐":pgvector 实战手记
python·agent·全栈
kyrie_sakura1 小时前
python学习笔记14 -- FastAPI
笔记·python·学习·fastapi
雪落漂泊1 小时前
C++11(上)
开发语言·c++
春涧草茶2 小时前
慢就是快12-2三种访问权限|getter与setter|魔法方法
开发语言·python
無限進步D2 小时前
Java Web 前端 简介
java·开发语言·前端·css·html·css3·web
小猿备忘录2 小时前
从架构师视角看“三高”:度量、设计与权衡
经验分享
夜雪一千2 小时前
如何使用Python做舆情分析
人工智能·python·数据分析