猫史档案馆


【Python作品分享】太极图【教程贴】

用户:理科狗理科狗查看:0 回复:0 评论:0 创建时间:2022-05-15T10:24:40


【作品展示】

center_image

 

【作品介绍】

1

 

【作品源代码】

import turtle
r = int(input('请输入半径:'))
c = input('请输入背景颜色:')
t = turtle.Pen()
turtle.bgcolor(c)
t.pensize(5)
t.penup()
t.hideturtle()

t.goto(0, -r)
t.begin_fill()
t.circle(r, 180)
t.end_fill()

t.color("white")
t.goto(0, -r)
t.begin_fill()
t.circle(-r, 180)
t.end_fill()

t.goto(0, 0)
t.begin_fill()
t.circle(r/2)
t.end_fill()

t.color("black")
t.goto(0, 0)
t.begin_fill()
t.circle(-r/2)
t.end_fill()

t.goto(0, r/3)
t.begin_fill()
t.circle(r/6)
t.end_fill()

t.color("white")
t.goto(0, -r/3)
t.begin_fill()
t.circle(-r/6)
t.end_fill()

turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页