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

运行效果

相关推荐
杜子不疼.几秒前
基于ATVC模板库的Ascend C Vector算子快速开发指南
c语言·开发语言·mfc
MSTcheng.2 分钟前
【C++】C++11新特性(三)
开发语言·c++·c++11
ZH15455891312 分钟前
Flutter for OpenHarmony Python学习助手实战:机器学习算法实现的实现
python·学习·flutter
learning-striving3 分钟前
kali连不上网解决方法
linux·开发语言·网络·php·kali
田野追逐星光9 分钟前
STL容器list的模拟实现
开发语言·c++·list
“负拾捌”11 分钟前
python + uniapp 结合腾讯云实现实时语音识别功能(WebSocket)
python·websocket·微信小程序·uni-app·大模型·腾讯云·语音识别
摇滚侠23 分钟前
macbook shell 客户端推荐 Electerm macbook 版本下载链接
java·开发语言
一个有梦有戏的人23 分钟前
Python3基础:函数基础,解锁模块化编程新技能
后端·python
程序员布吉岛25 分钟前
Java 后端定时任务怎么选:@Scheduled、Quartz 还是 XXL-Job?(对比 + 避坑 + 选型)
java·开发语言
C++ 老炮儿的技术栈27 分钟前
Qt Creator中不写代如何设置 QLabel的颜色
c语言·开发语言·c++·qt·算法