今天闲来无事,就看着网上的相关内容自己敲了一个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"))
代码源于网络