turtle绘制花朵


import turtle
angles=(0,30,60,90,120,150,180,210,240,270,300,330)
colors=("blue","green","pink","purple","black","red","yellow","grey","white","beige","ivory","thistle")
angles2=(0,180)
def huaban(ang,color):
    turtle.pensize(2)
    turtle.color("black",color)  
    turtle.seth(ang)
    turtle.right(15)
    turtle.pendown()
    turtle.begin_fill()
    turtle.circle(250,30)
    turtle.left(150)
    turtle.circle(250,30)
    turtle.end_fill()
    turtle.penup()
def yezi(ang):
    turtle.pensize(2)
    turtle.color("black","green")  
    turtle.seth(ang)
    turtle.right(15)
    turtle.pendown()
    turtle.begin_fill()
    turtle.circle(120,60)
    turtle.left(120)
    turtle.circle(120,60)
    turtle.end_fill()
    turtle.penup()
def main():
    turtle.setup(500,800)
    turtle.penup()
    turtle.seth(90)
    turtle.fd(200)
    turtle.speed(0)
    for i in range(12):
        huaban(angles[i],colors[i])
    turtle.seth(270)
    turtle.pendown()
    turtle.fd(200)
    for j in range(2):
        yezi(angles2[j])
    turtle.seth(270)
    turtle.pendown()
    turtle.fd(200)
        
main()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM