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

运行效果

相关推荐
学IT的周星星7 分钟前
java常见面试题
java·开发语言
Together_CZ7 分钟前
DarkIR: Robust Low-Light Image Restoration——鲁棒的低光照图像复原
python·image·robust·darkir·鲁棒的低光照图像复原·low-light·restoration
探索宇宙真理.8 分钟前
WordPress AI Engine信息泄露漏洞 | CVE-2025-11749 复现&研究
人工智能·经验分享·开源·安全漏洞
wjs202417 分钟前
XPath 运算符
开发语言
Mr.朱鹏20 分钟前
大模型入门学习路径(Java开发者版)上
java·开发语言·spring boot·spring·大模型·llm·transformer
拾贰_C21 分钟前
【python | pytorch | scipy】scipy scikit-learn库相互依赖?
pytorch·python·scipy
黎雁·泠崖23 分钟前
C 语言指针进阶教程:const 修饰、野指针规避与传址调用
c语言·开发语言
lsx20240628 分钟前
ASP TextStream
开发语言
BoBoZz1929 分钟前
PolyDataContourToImageData 3D集合图像转换成等效3D二值图像
python·vtk·图形渲染·图形处理
cike_y30 分钟前
JSP标签&JSTL标签&EL表达式
java·开发语言·jsp