码迷,mamicode.com
首页 > 编程语言 > 详细

python设计花蕾

时间:2019-09-27 01:36:29      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:gre   python   font   red   turtle   size   main   range   pen   

#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()

python设计花蕾

标签:gre   python   font   red   turtle   size   main   range   pen   

原文地址:https://www.cnblogs.com/yan-lin/p/11595158.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!