今天520,看到好多人表白。
看到有个绘制桃心的程序我也试试hhhhhhhh
import turtle as t
import time
def setTurtle():
t.screensize(900,700,'pink') #窗口大小
t.color('red','pink') #颜色
t.pensize(3) #笔粗细
t.speed(50) #速度
t.penup() #提笔
def getStart(h):
#去到的坐标,窗口中心为0,0
t.goto(0,-180)
r=h/5
drawBigL(r,h)
drawBigArc(r,140)
drawBigArc(r,70)
drawBigR(r,h)
centerRange()
drawHope()
drawName()
time.sleep(2)
def drawBigL(r,h):
colors=['red','orange','yellow','#87CEEB','violet','red']
for i in range(int(240/h)+1):
t.seth(0)
t.color(colors[i],colors[i+1])
drawHeart(r)
t.seth(140)
t.fd(h)
def drawBigArc(r,rad):
colors=['red','orange','yellow','SkyBlue','violet','red']
for i in range(50):
if(i%10==0):
t.color(colors[int(i/10)],colors[int(i/10)+1])
t.seth(0)
drawHeart(r)
t.seth(rad-(i+1)*4)
t.rt(4)
t.fd(10.5)
def drawBigR(r,h):
colors=['red','orange','yellow','SkyBlue','violet','red']
for i in range(int(240/h)+1):
t.color(colors[i],colors[i+1])
t.seth(0)
drawHeart(r)
t.setheading(220)
t.fd(h)
def drawHeart(r):
t.down()
t.begin_fill()
factor=180
t.seth(45)
t.circle(-r,factor)
t.fd(2*r)
t.right(90)
t.fd(2*r)
t.circle(-r,factor)
t.end_fill()
t.up()
#在心中写字
def centerRange():
t.goto(0,0)
t.write('520',font=('华文行楷',100),align="center",move=True)
t.goto(0, -100)
t.write('1314', font=('华文行楷', 75), align="center", move=True)
time.sleep(0.1)
def drawCenter(i):
t.goto(0,0)
colors=['red','orange','yellow','SkyBlue','violet','red']
t.pencolor(colors[i])
#在心中写字font可以设置字体自己电脑有的都可以设align开始写字的位置
#write('love...',font=('gungsuh',30,),align="cener")
t.up()
#写寄语
def drawHope():
t.pencolor('black')
t.goto(-300,-220)
t.showturtle()
t.write('我不擅长恋爱,',font=('华文行楷',25),align="center",move=True)
t.goto(-300,-270)
t.write('但我天生爱你。',font=('华文行楷',25),align="center",move=True)
#写署名
def drawName():
t.pencolor('black')
t.goto(250,-250)
t.showturtle()
t.write('2020.5.20',font=('gungsuh',20,),align="center",move=True)
time.sleep(2)
setTurtle()
getStart(80)