import turtle as t
def yu(radius, color1, color2):
t.color("black", color1) # 边的颜色,填充颜色
t.begin_fill() # 开始填充
# circle 圆形
t.circle(radius / 2, 180)
t.circle(radius, 180)
t.left(180)
t.circle(-radius / 2, 180)
t.end_fill() # 结束填充
t.left(90)
t.up()
t.fd(radius*0.35)
t.down()
t.right(90)
t.color(color1, color2)
t.begin_fill()
t.circle(radius *0.15)
t.end_fill()
t.up()
t.right(90)
t.forward(radius*0.35)
t.right(90)
t.down()
def main():
t.shape("turtle")
t.speed(9)
t.width(5)
yu(300,"black", "red") # 大圆颜色。小圆颜色
yu(300,"red", "black")
main()
t.done()
kewin-用python函数画太极图
最新推荐文章于 2024-07-20 17:03:08 发布