使用python制作小心心

今天闲来无事,就看着网上的相关内容自己敲了一个python的小心心

import turtle
t=turtle.Turtle()
def fd(a):
    t.forward(a)
t.pensize(3)
t.hideturtle()
t.speed(10)
def up():
    t.penup()
def down():
    t.pendown()
t.hideturtle()
t.speed(10)#控制画笔速度
t.fillcolor('red')
up()
t.goto(-200,80)
down()
t.pencolor('pink')
t.write('小姐姐:',font=("Courier",15,"bold"))

up()
t.goto(-100,0)
down()
t.pencolor('black')
t.pensize(3)
t.circle(20)
t.setheading(270)
fd(50)
t.setheading(225)
fd(35)
t.goto(-100,-50)
t.setheading(0)
fd(35)
t.setheading(270)
fd(28)
up()
t.goto(-100,-15)
down()
t.setheading(0)
fd(30)
t.setheading(45)
fd(12)
up()
t.goto(-100,-25)
down()
t.setheading(0)
fd(40)
t.setheading(-45)
fd(12)
def xin():
    up()
    t.goto(0,20)
    t.pencolor('red')
    down()
    t.begin_fill()
    t.speed(10)
    t.setheading(135)
    for i in range(10):
        t.left(20)
        fd(3)
    for i in range(6):
        t.left(10)
        fd(3.5)
    t.end_fill()
    up()
    t.goto(0,20)
    down()
    t.begin_fill()
    t.setheading(45)
    for i in range(10):
        t.right(20)
        fd(3)
    for i in range(6):
        t.right(10)
        fd(3.5)
    t.end_fill()
xin()

def move():
    t.pencolor('red')
    t.speed(100)
    t.setheading(135)
    for i in range(100):
        t.left(2)
        fd(1)
    for i in range(5):
        t.left(1)
        fd(6.83)
    up()
    t.goto(100,50)
    down()
    t.setheading(45)
    for i in range(100):
        t.right(2)
        fd(1)
    for i in range(5):
        t.right(1)
        fd(6.83)
up()
t.goto(100,50)
down()
t.begin_fill()
move()

t.end_fill()
up()
t.goto(0,-100)
down()
t.pencolor('pink')
t.write('***小可爱***',font=("Courier",20,"bold"))

代码源于网络

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值