「Python绘图」绘制太极图

python 绘制太极

一、预期结果

二、核心代码

复制代码
import turtle

pen = turtle.Turtle()

print("开始绘制太极")

radius = 100
pen.color("black", "black")
pen.begin_fill()
pen.circle(radius/2, 180)
pen.circle(radius, 180)
pen.left(180)
pen.circle(-radius/2, 180)
pen.end_fill() 


pen.left(90)
pen.pu()
pen.fd(radius*0.35)
pen.right(90)
pen.pd()

print("绘制小圆")
pen.color("white", "white")
pen.begin_fill()
pen.circle(radius*0.15)
pen.end_fill() 


pen.left(90)
pen.up()
pen.backward(radius*0.7)
pen.down()
pen.left(90)

print("绘制小圆")
pen.color("black", "black")
pen.begin_fill()
pen.circle(radius*0.15)
pen.end_fill()

print("补大圆")
pen.right(90)
pen.pu()
pen.backward(radius*0.65)
pen.right(90)
pen.pd()
pen.circle(radius, 180)
print("绘制完成")
pen.ht()
turtle.done()
相关推荐
weixin_440784117 小时前
【HandlerThread实现原理】
android·java·开发语言
天空'之城7 小时前
C 语言工业级通用组件手写 24:互补滤波
c语言·开发语言·互补滤波·嵌入式算法·工业级组件
XR1234567887 小时前
工厂车间无线网络方案对比:AGV漫游哪家强?
开发语言·php
傻啦嘿哟7 小时前
某短视频平台视频爬虫实战:抓取推荐流视频信息,绕过反爬的3种技巧
开发语言·爬虫·python
迷迭香yy8 小时前
集合竞价数据挖掘实战:用Python构建开盘信号识别系统
人工智能·python·数据挖掘
現実君8 小时前
【硬件进阶】AD22上位替换JLEDA教程
开发语言·php
mubei-1238 小时前
SpringDAO的用法
java·开发语言·数据库
李昊哲小课10 小时前
fastapi sse websocket 奶茶店实时订单看板
人工智能·python·websocket·网络协议·fastapi·sse
格林威11 小时前
多相机微秒级对齐:硬件触发 vs PTP(IEEE 1588)方案实战对比
开发语言·人工智能·数码相机·机器学习·计算机视觉·视觉检测·机器视觉
初级代码游戏12 小时前
iOS开发 Swift 速记2:三种集合类型 Array Set Dictionary
开发语言·ios·swift