python 表白代码 biu 比心

使用标准库 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(-28, 125)
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(-100, 115)
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(-120, 60)
t.pencolor("pink")
t.down()
t.seth(90)
t.forward(8)
t.up()
t.goto(-110, 60)
t.pencolor("pink")
t.down()
t.seth(90)
t.forward(12)

t.up()
t.goto(10, 80)
t.pencolor("pink")
t.down()
t.seth(90)
t.forward(8)
t.up()
t.goto(0, 80)
t.pencolor("pink")
t.down()
t.seth(90)
t.forward(12)

t.up()
t.goto(-40, 70)
t.down()
t.pencolor("black")
t.left(180)
t.circle(-16,170)

t.up()
t.goto(p[0], p[1])
t.down()
t.left(150)
t.circle(100, 30)
t.left(80)
t.forward(10)

p2 = t.position()
t.up()
t.goto(p2[0]+10, p2[1]+20)
t.down()
t.seth(0)
t.right(95)
t.forward(100)
t.right(90)
t.forward(10)
t.circle(10,90)
t.left(95)
t.forward(60)
t.left(90)
t.forward(20)
t.circle(-10,180)
t.forward(20)
t.left(90)
t.forward(50)
t.circle(10, 90)
t.left(90)
t.forward(10)
t.right(85)
t.forward(70)
t.circle(90, 25)
p = t.position()

t.up()
t.goto(p[0]+10, p[1])
t.down()
t.seth(30)
t.forward(80)
t.right(50)
t.circle(80, 15)
t.left(100)
t.forward(10)
t.right(50)
t.forward(20)
t.circle(4, 180)
t.right(5)
t.forward(20)
t.right(80)
t.forward(10)
t.right(50)
t.circle(4, 180)
t.left(30)
t.forward(10)
t.right(100)
t.forward(80)

t.up()
t.goto(88, 45)
t.down()
t.pencolor("pink")
t.setheading(0)
t.begin_fill()
t.color("pink")
t.left(45)
t.forward(20)
t.circle(10, 180)
t.right(90)
t.circle(10, 180)
t.forward(20)
t.end_fill()

t.pencolor("white")
t.up()
t.goto(77, 55)
t.down()
t.write("比心",font=("Arial",10,"bold"))

t.pencolor("black")
t.up()
t.goto(88, -20)
t.down()
t.write("b",font=("Arial",16,"bold"))
t.up()
t.goto(102, -18)
t.down()
t.write("i",font=("Arial",16,"bold"))
t.up()
t.goto(110, -16)
t.down()
t.write("u",font=("Arial",16,"bold"))

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

t.pencolor("red")
text = "爱你哦~~~"
j = 1
t.up()
t.goto(-104, 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(-80, -240)
t.down()
text = "要源码评论区讲哈~~~"
t.write(text, font=("Arial", 15, "bold"))

t.ht()
t.done()


---- 结束 ----
仅学习。

猜你喜欢

转载自blog.csdn.net/qq_52722885/article/details/127905519
biu
今日推荐