猫史档案馆


【Python作品分享】Turtle作品之阴阳【作品秀】

用户:梦里觅深海梦里觅深海查看:0 回复:6 评论:0 创建时间:2019-09-24T18:04:24


【作品展示】

center_image

 

【作品介绍】

非本人作品。是引用了python中的Turtle Demo的yinyang

 

【作品源代码】

from turtle import *


def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()
    color(color1, color2)
    begin_fill()
    circle(radius*0.15)
    end_fill()
    left(90)
    up()
    backward(radius*0.35)
    down()
    left(90)


def main():
    reset()
    yin(200, "black", "white")
    yin(200, "white", "black")
    ht()
    return "Done!"


if __name__ == '__main__':
    main()
    mainloop()
from turtle import *

def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()
    color(color1, color2)
    begin_fill()
    circle(radius*0.15)
    end_fill()
    left(90)
    up()
    backward(radius*0.35)
    down()
    left(90)

def main():
    reset()
    yin(200, "black", "white")
    yin(200, "white", "black")
    ht()
    return "Done!"

if __name__ == '__main__':
    main()
    mainloop()


def yin(radius, color1, color2):
    width(3)
    color("black", color1)
    begin_fill()
    circle(radius/2., 180)
    circle(radius, 180)
    left(180)
    circle(-radius/2., 180)
    end_fill()
    left(90)
    up()
    forward(radius*0.35)
    right(90)
    down()
    color(color1, color2)
    begin_fill()
    circle(radius*0.15)
    end_fill()
    left(90)
    up()
    backward(radius*0.35)
    down()
    left(90)


def main():
    reset()
    yin(200, "black", "white")
    yin(200, "white", "black")
    ht()
    return "Done!"


if __name__ == '__main__':
    main()
    mainloop()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
梦里觅深海梦里觅深海

求回复

点赞0


评论


QBZ_QBZ_

嗯嗯,你这是自学的海龟库的其他功能?

点赞0


评论


梦里觅深海梦里觅深海

不是,是引用了python中Turtle Demo的其中之一yinyang

点赞0


评论


爵士OIer爵士OIer

可惜我没学过python

点赞0


评论


梦里觅深海梦里觅深海

https://shequ.codemao.cn/community/199167

https://shequ.codemao.cn/community/199075

https://shequ.codemao.cn/community/199074

点赞0


评论


梦里觅深海梦里觅深海

借本书自学

点赞0


评论