您的位置:首页 > 编程语言 > Python开发

python turtle库 简单图形-中国结

2018-06-02 16:47 204 查看

代码执行效果

程序源代码:
import turtle
turtle.screensize(600,800)
turtle.pensize(10)
turtle.pencolor("red")
turtle.seth(-45)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(102)
turtle.circle(6,180)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(102)
turtle.circle(6,180)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(102)
turtle.circle(6,180)
turtle.fd(92)
turtle.circle(-6,270)
turtle.fd(92)
turtle.circle(6,180)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(102)
turtle.circle(6,180)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(102)
turtle.circle(6,180)
turtle.fd(102)
turtle.circle(-6,180)
turtle.fd(88)
turtle.fd(20)
turtle.seth(135)
turtle.fd(20)
turtle.seth(225)
turtle.fd(20)
turtle.seth(315)
turtle.fd(20)
turtle.seth(45)
turtle.fd(20)
turtle.seth(135)
turtle.begin_fill()
turtle.fillcolor("red")
turtle.fd(50)
turtle.seth(45)
turtle.fd(30)
turtle.seth(-45)
turtle.fd(30)
turtle.seth(225)
turtle.fd(30)
turtle.end_fill()
turtle.seth(90)
turtle.fd(40)
turtle.pensize(20)
turtle.fd(10)
turtle.pensize(5)
turtle.seth(105)
turtle.fd(30)
turtle.circle(-8,240)
turtle.circle(20,20)
turtle.fd(5)
turtle.circle(20,60)
turtle.fd(25)
turtle.penup()
turtle.setx(0)
turtle.sety(0)
turtle.goto(2,-127)
turtle.pendown()
turtle.pensize(5)
turtle.begin_fill()
turtle.fillcolor("red")
turtle.seth(0)
turtle.fd(15)
turtle.seth(-90)
turtle.fd(10)
turtle.seth(180)
turtle.fd(15)
turtle.seth(90)
turtle.fd(10)
turtle.seth(0)
turtle.fd(15)
turtle.end_fill()
turtle.pensize(2)
for x in range(6):
turtle.seth(-90)
turtle.fd(50)
turtle.penup()
turtle.seth(90)
turtle.fd(50)
turtle.seth(180)
turtle.fd(3)
turtle.pendown()

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: