猫史档案馆


【Python作品分享】爱心气球【作品秀】

用户:幽默的小黄鸡1581幽默的小黄鸡1581查看:0 回复:0 评论:0 创建时间:2020-11-08T21:11:38


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

import turtle


mypen = turtle.Pen()
n = (360 / 4)
i = 0
angle = ((360 / n) / 4)
while (i < n):
    mypen.forward(1)
    mypen.left(angle)
    i = (i + 1)
mypen.forward(50)

mypen.pencolor('lightskyblue')
mypen.begin_fill()
mypen.fillcolor('lightskyblue')
mypen.right(45)
length = 100
i = 0
while (i < 4):
    mypen.forward(length)
    mypen.left(90)
    i = (i + 1)
mypen.end_fill()


mypen.forward(length)
mypen.left(90)
mypen.forward((length / 2))
mypen.dot(length)


mypen.forward((length / 2))
mypen.left(90)
mypen.forward((length / 2))
mypen.dot(length)


mypen.right(90)
mypen.forward((length / 4))
mypen.pencolor('white')
mypen.dot((length / 10))
mypen.penup()


mypen.right(90)
mypen.forward((length / 6))
mypen.pendown()
mypen.pencolor('white')
mypen.dot((length / 8))

mypen.hideturtle()
turtle.done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页