520要来啦,快去给心仪的她写表白代码趴!(python)

代码

#coding=utf-8

#导入模块,操纵海龟绘图
from turtle import *


#设置颜色
color('purple', 'red')
#开始准备颜色填充图形
begin_fill()


#调整画笔宽度
pensize(3)


#提起画笔,放下画笔
penup()
goto(50, 50)
pendown()



#顺时针移动45right(45)
#将画笔移动到(100,0)的位置
goto(100, 0)
#逆时针移动90left(90)
#画笔像绘制方向的当前方向运动120像素
forward(120)
#画圆
circle(50, 225)


#提起画笔,放下画笔
penup()
goto(0, 0)
pendown()


#逆时针移动135left(135)
#画笔向绘制方向的当前方向运动120像素
forward(120)
#画圆
circle(50, 225)
#向北运动
seth(90)
circle(50, 225)



forward(121)
#结束颜色填充图形
end_fill()
left(56)


penup()
#走到该坐标位置(-21040goto(-210, 40)
pendown()
goto(0,80)
penup()
goto(160, 110)
pendown()
goto(320, 140)

#输入句子“xxxxxxxxxxxxxx”
write("I LOVE YOU!", False, 'center')

#结束
done()


参考:https://blog.csdn.net/weixin_43778797/article/details/101428428
运行结果
注:此图可动,拿代码去运行一下就可
在这里插入图片描述
哈哈希望可以帮到你哟!

猜你喜欢

转载自blog.csdn.net/hanhanwanghaha/article/details/106211876