python turtle表白心爱的人

使用python中的turtle海龟库写表白代码

快去发给你心爱的人吧!

效果图:

在这里插入图片描述

代码:

import time
import turtle as t
t.speed(0)
t.pensize(4)

t.home()
t.left(30)
t.circle(100, 300)
p = t.position()

t.up()
t.goto(-30, 120)
t.down()
t.right(60)
t.circle(20)
t.up()
t.goto(-28, 115)
t.down()
t.begin_fill()
t.fillcolor("black")
t.circle(10)
t.end_fill()

t.begin_fill()
t.fillcolor("white")
t.circle(6)
t.end_fill()


t.up()
t.goto(-120, 120)
t.down()
t.circle(20)
t.up()
t.goto(-100, 125)
t.down()
t.begin_fill()
t.fillcolor("black")
t.circle(10)
t.end_fill()

t.up()
t.goto(-95, 120)
t.down()
t.begin_fill()
t.fillcolor("white")
t.circle(6)
t.end_fill()


t.up()
t.goto(-130, 60)
t.down()
t.begin_fill()
t.color("#FFB5C5")
t.circle(8)
t.end_fill()

t.up()
t.goto(5, 60)
t.down()
t.begin_fill()
t.color("#FFB5C5")
t.circle(8)
t.end_fill()


t.up()
t.goto(-60, 70)
t.down()
t.pencolor("black")
t.circle(5)


t.pencolor("black")
t.up()
t.goto(-80, 40)
t.down()
t.left(10)
t.circle(30, 160)


t.up()
t.goto(p[0], p[1])
t.down()
t.left(150)
t.circle(100, 70)
p2 = t.position()
t.up()
t.goto(p[0]+10, p[1]-20)
t.down()
t.right(40)
t.circle(40, 50)
t.forward(10)
t.left(100)
t.circle(40, 80)


t.up()
t.goto(p[0]+60, p[1]-10)
t.down()
t.left(130)
t.circle(80, 30)
t.left(100)
t.circle(40, 80)
t.up()
t.goto(p2[0]+120, p2[1])
t.down()
t.right(27)
t.circle(260, 25)

t.up()
t.goto(-74, 250)
t.down()
a = t.position()
j = 1
text = "小姐姐"
for txt in text:
    t.write(txt, font=("Arial", 15, "bold"))
    t.up()
    t.goto(a[0]+(j*30), a[1])
    t.down()
    j += 1
    time.sleep(0.05)

text = "我想把自己送给你~~~"
j = 1
t.up()
t.goto(-174, 215)
t.down()
a = t.position()
for txt in text:
    t.write(txt, font=("Arial", 15, "bold"))
    t.up()
    t.goto(a[0]+(j*30), a[1])
    t.down()
    j += 1
    time.sleep(0.05)


t.up()
t.goto(70, -50)
t.down()
t.pencolor("red")
t.setheading(0)
t.begin_fill()
t.color("red")
t.left(45)
t.forward(40)
t.circle(20, 180)
t.right(90)
t.circle(20, 180) 
t.forward(40)
t.end_fill()

t.ht()
t.done()

—结束—
仅学习。

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值