情人节玫瑰

Posted walxt

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了情人节玫瑰相关的知识,希望对你有一定的参考价值。

# 今年的情人节和以往并不相同,由于疫情的关系多少相恋的人没有办法见面,情人节肯定要有玫瑰花啊 ,这样显得多么的完美。于是我自己手绘了一个玫瑰送给我的爱人,给需要的人一个帮助。

# coding=utf-8
import turtle
import time

def initialization():
# 初始化画布和画笔
turtle.setup(width=0.9, height=0.9)
turtle.speed(5)


def flower():
# 勾勒花蕊
turtle.goto(0, 200)
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(10, 180)
turtle.circle(25, 110)
turtle.left(50)
turtle.circle(60, 45)
turtle.circle(20, 170)
turtle.right(24)
turtle.fd(30)
turtle.left(10)
turtle.circle(30, 110)
turtle.fd(20)
turtle.left(40)
turtle.circle(90, 70)
turtle.circle(30, 150)
turtle.right(30)
turtle.fd(15)
turtle.circle(80, 90)
turtle.left(15)
turtle.fd(45)
turtle.right(165)
turtle.fd(20)
turtle.left(155)
turtle.circle(150, 80)
turtle.left(50)
turtle.circle(150, 90)
turtle.end_fill()


def petaOne():
# 勾勒花瓣
turtle.left(150)
turtle.circle(-90, 70)
turtle.left(20)
turtle.circle(75, 105)
turtle.setheading(60)
turtle.circle(80, 98)
turtle.circle(-90, 40)


def petaTwo():
# 勾勒花瓣
turtle.left(180)
turtle.circle(90, 40)
turtle.circle(-80, 98)
turtle.setheading(-83)


def leafOne():
# 勾勒叶子
turtle.fd(30)
turtle.left(90)
turtle.fd(25)
turtle.left(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(-80, 90)
turtle.right(90)
turtle.circle(-80, 90)
turtle.end_fill()
turtle.right(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(85)
turtle.left(90)
turtle.fd(80)


def leafTwo():
# 勾勒叶子
turtle.right(90)
turtle.right(45)
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(80, 90)
turtle.left(90)
turtle.circle(80, 90)
turtle.end_fill()
turtle.left(135)
turtle.fd(60)
turtle.left(180)
turtle.fd(60)
turtle.right(90)
turtle.circle(200, 60)
turtle.hideturtle()


def sayText():
love = "情人节快乐,祝你的每一天都可以开心"
t = turtle.Pen()
t.hideturtle()
t.penup()
t.forward(200)
t.right(100)
t.pendown()
t.write(love, font=("华文行楷",20, "bold"))


if __name__ == ‘__main__‘:
initialization()
sayText()
time.sleep(1)
flower()
petaOne()
petaTwo()
leafOne()
leafTwo()
time.sleep(5)

# 效果如下所示:

技术图片

 

以上是关于情人节玫瑰的主要内容,如果未能解决你的问题,请参考以下文章

python表白玫瑰花绘制——情人节表白

情人节玫瑰

MATLAB | 情人节来绘制更立体的玫瑰花吧

情人节送ta一朵独一无二的玫瑰花

Python实用工具(情人节献礼)turtle函数绘制动态玫瑰花

Python实用工具(情人节献礼)turtle函数绘制动态玫瑰花