当前位置 : 主页 > 编程语言 > python >

python设计花蕾

来源:互联网 收集:自由互联 发布时间:2021-06-25
#coding=gbk import turtle #设计树干 turtle.right(90) turtle.pensize(2) turtle.pencolor("black") turtle.fillcolor("green") turtle.begin_fill() for _ in range(2): turtle.forward(200) turtle.left(90) turtle.forward(20) turtle.left(90) turt

#coding=gbk
import turtle

#设计树干
turtle.right(90)
turtle.pensize(2)
turtle.pencolor("black")
turtle.fillcolor("green")
turtle.begin_fill()
for _ in range(2):
turtle.forward(200)
turtle.left(90)
turtle.forward(20)
turtle.left(90)
turtle.end_fill()
turtle.left(90)
turtle.goto(10,0)

#设计花蕾
turtle.right(60)
turtle.fillcolor("red")
turtle.begin_fill()
for _ in range(6):
turtle.circle(50,180)
turtle.right(120)
turtle.end_fill()

#设计花芯
turtle.penup()
turtle.goto(10,20)
turtle.pendown()
turtle.left(60)
turtle.pensize(1)
turtle.color("black","violet")
turtle.begin_fill()
turtle.circle(80)
turtle.end_fill()


#设计叶子
turtle.penup()
turtle.goto(20,-110)
turtle.pendown()
turtle.fillcolor("green")
turtle.begin_fill()
turtle.left(10)
turtle.circle(200,60)
turtle.left(120)
turtle.circle(200,60)
turtle.end_fill()

turtle.penup()
turtle.goto(0,-110)
turtle.pendown()
turtle.right(140)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.left(10)
turtle.circle(200,60)
turtle.left(120)
turtle.circle(200,60)
turtle.end_fill()

turtle.penup() #箭头连线断开
turtle.goto(-150,-260) #字体位置
turtle.color("yellow") #字体颜色
turtle.write("送你一朵小花花", font=(‘Arial‘, 30, ‘normal‘))

turtle.mainloop()

网友评论