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

运行效果

相关推荐
名字还没想好☜8 小时前
Go 用 slices/maps 标准库泛型函数:告别手写 Contains、Sort、去重(Go 1.21)
开发语言·后端·算法·golang·go
淼澄研学8 小时前
Python实战:基于LangChain与Chroma构建企业级RAG知识库问答系统
开发语言·python·langchain
辰辉创聚8 小时前
In Vivo抗体是什么?| 体内抗体与普通科研抗体的区别
人工智能·python·时序数据库·in vivo抗体·体内抗体·体内级抗体
深圳市宝华视联8 小时前
Python 读取 IP 视频流简单 Demo
python·嵌入式硬件·opencv·网络协议·tcp/ip·实时音视频·嵌入式实时数据库
4311媒体网8 小时前
帝国CMS网站自定义搭建技巧
服务器·开发语言·前端
布莱克6059 小时前
C++拷贝构造与拷贝赋值运算符的区别详解
开发语言·c++
门思科技9 小时前
LoRaWAN Regional Parameters:为什么 CN470 和 EU868 的频点数不同
python·物联网
lhldsg9 小时前
全民健身解决方案:从共享球场到智能运营的技术实践
java·大数据·开发语言·需求分析
AIHR数智引擎9 小时前
如何用WorkBuddy跑通HR自动化流程?
人工智能·经验分享·chatgpt·职场和发展·自动化·ai-native
Joseph 乔9 小时前
【Python】卸载与重装
经验分享·python