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

运行效果

相关推荐
Chan16几秒前
《Java并发编程的艺术》| 并发关键字与 JMM 核心规则
java·开发语言·数据库·spring boot·java-ee·intellij-idea·juc
薛定谔的猫喵喵1 分钟前
解决 xlrd 2.0+ 版本只支持 xls 格式的问题
python·excel
期待のcode12 分钟前
线程睡眠sleep方法
java·开发语言
gjxDaniel12 分钟前
Bash编程语言入门与常见问题
开发语言·bash
zhooyu13 分钟前
OpenGL 与 C++:深入理解与实现 Transform 组件
开发语言·c++
2501_9418053116 分钟前
使用Python和Go构建高性能分布式任务调度系统的实践分享
分布式·python·golang
captain37629 分钟前
Java-链表
java·开发语言·链表
tqs_1234530 分钟前
跳出多层循环的方式
java·开发语言
OLOLOadsd12331 分钟前
基于YOLO11-C3k2-LFE的岩石颗粒智能检测与识别系统_2
python
froginwe1135 分钟前
媒体查询:现代网页设计的核心工具
开发语言