Commit 0b4fe5fa by BellCodeEditor

auto save

parent bfb1a146
Showing with 379 additions and 0 deletions
#!/usr/bin/env python
# coding:utf-8
from turtle import *
import time
def setTurtle():
    # 窗口大小
    screensize(900, 700, 'pink')
    # 颜色
    color('red', 'pink')
    # 笔粗细
    pensize(3)
    # 速度
    speed(6)
    # 提笔
    penup()
 
 
def getStart(h):
    # 去到的坐标,窗口中心为0,0
    goto(0, -180)
    r = h / 5
    drawBigL(r, h)
    drawBigArc(r, 140)
    drawBigArc(r, 70)
    drawBigR(r, h)
    centerRange()
    drawHope()
    drawName()
 
 
def drawBigL(r, h):
    colors = ['red', 'orange', 'yellow', '#87CEEB', 'violet', 'red']
    for i in range(int(240 / h) + 1):
        seth(0)
        color(colors[i], colors[i + 1])
        drawHeart(r)
        seth(140)
        fd(h)
 
 
def drawBigArc(r, rad):
    colors = ['red', 'orange', 'yellow', 'SkyBlue', 'violet', 'red']
    for i in range(50):
        if (i % 10 == 0):
            color(colors[int(i / 10)], colors[int(i / 10) + 1])
            seth(0)
            drawHeart(r)
            seth(rad - (i + 1) * 4)
        rt(4)
        fd(10.5)
 
 
def drawBigR(r, h):
    colors = ['red', 'orange', 'yellow', 'SkyBlue', 'violet', 'red']
    for i in range(int(240 / h) + 1):
        color(colors[i], colors[i + 1])
        seth(0)
        drawHeart(r)
        setheading(220)
        fd(h)
 
 
def drawHeart(r):
    down()
    begin_fill()
    factor = 180
    seth(45)
    circle(-r, factor)
    fd(2 * r)
    right(90)
    fd(2 * r)
    circle(-r, factor)
    end_fill()
    up()
 
 
# 在心中写字
def centerRange():
    for i in range(6):
        drawCenter(i)
        time.sleep(1)
 
 
def drawCenter(i):
    goto(0, 0)
    colors = ['red', 'orange', 'yellow', 'SkyBlue', 'violet', 'red']
    pencolor(colors[i])
    # 在心中写字 font可以设置字体自己电脑有的都可以设 align开始写字的位置
    write('love SPY', font=('gungsuh', 30,), align="center")
    up()
 
# 写寄语
def drawHope():
    pencolor('black')
    goto(-300, -220)
    showturtle()
    write('xxxx,', font=('华文行楷', 25,), align="center", move=True)
    goto(-300, -270)
    write('xxxx。', font=('华文行楷', 25,), align="center", move=True)
 
# 写署名
def drawName():
    pencolor('black')
    goto(250, -250)
    showturtle()
    write('xxxx', font=('gungsuh', 20,), align="center", move=True)
 
 
setTurtle()
getStart(80)
 
# 点击窗口关闭
window = Screen()
window.exitonclick()
import turtle
import time
# 画爱心的顶部
def LittleHeart():
for i in range(200):
turtle.right(1)
turtle.forward(2)
# 输入表白的语句,默认I Love you
love = input('Please enter a sentence of love, otherwise the default is "I Love you": ')
# 输入署名或者赠谁,没有不执行
me = input('Please enter pen name, otherwise the default do not execute: ')
if love == '':
love = 'I Love you'
# 窗口大小
turtle.setup(width=900, height=500)
# 颜色
turtle.color('red', 'pink')
# 笔粗细
turtle.pensize(3)
# 速度
turtle.speed(1)
# 提笔
turtle.up()
# 隐藏笔
turtle.hideturtle()
# 去到的坐标,窗口中心为0,0
turtle.goto(0, -180)
turtle.showturtle()
# 画上线
turtle.down()
turtle.speed(1)
turtle.begin_fill()
turtle.left(140)
turtle.forward(224)
# 调用画爱心左边的顶部
LittleHeart()
# 调用画爱右边的顶部
turtle.left(120)
LittleHeart()
# 画下线
turtle.forward(224)
turtle.end_fill()
turtle.pensize(5)
turtle.up()
turtle.hideturtle()
# 在心中写字 一次
turtle.goto(0, 0)
turtle.showturtle()
turtle.color('#CD5C5C', 'pink')
# 在心中写字 font可以设置字体自己电脑有的都可以设 align开始写字的位置
turtle.write(love, font=('gungsuh', 30,), align="center")
turtle.up()
turtle.hideturtle()
time.sleep(2)
# 在心中写字 二次
turtle.goto(0, 0)
turtle.showturtle()
turtle.color('red', 'pink')
turtle.write(love, font=('gungsuh', 30,), align="center")
turtle.up()
turtle.hideturtle()
# 写署名
if me != '':
turtle.color('black', 'pink')
time.sleep(2)
turtle.goto(180, -180)
turtle.showturtle()
turtle.write(me, font=(20,), align="center", move=True)
# 点击窗口关闭
window = turtle.Screen()
window.exitonclick()
\ No newline at end of file
print('\n'.join([''.join([('Lovemom'[(x-y) % len('Lovemom')]if ((x*0.05)**2+(y*0.1)**2-1)**3-(x*0.05)**2*(y*0.1)**3 <= 0 else ' ')for x in range(-30, 30)])for y in range(30, -30, -1)]))
\ No newline at end of file
import os
import time
from random import randint
for i in range(1, 35): # 打印抬头
print('')
heartStars = [2,4,8,10,14,20,26,28,40,44,52,60,64,76] # *的位置
heartBreakLines = [13, 27, 41, 55, 69, 77] # 空格的位置
flowerBreakLines = [7, 15, 23, 31, 39, 46]#玫瑰的空列位置
def addSpaces(a):#添加空列
count = a
while count > 0:
print(' ', end='')
count -= 1
def newLineWithSleep():#添加空行
time.sleep(0.3)
print('\n', end='')
play = 0
while play == 0:
Left_Spaces = randint(8, 80)
addSpaces(Left_Spaces)
for i in range(0, 78):#比心的形状
if i in heartBreakLines:
newLineWithSleep()
addSpaces(Left_Spaces)
elif i in heartStars:
print('*', end='')
elif i in (32, 36):
print('M', end='')
elif i == 34:
print('O', end='')
else:
print(' ', end='')
newLineWithSleep()
addSpaces(randint(8, 80))
print("H a p p y M o t h e r ' s D a y !", end='')
newLineWithSleep()
newLineWithSleep()
Left_Spaces = randint(8, 80)
addSpaces(Left_Spaces)
for i in range(0, 47):#向母亲献花
if i in flowerBreakLines:
newLineWithSleep()
addSpaces(Left_Spaces)
elif i in (2, 8, 12, 18):
print('{', end='')
elif i in (3, 9, 13, 19):
print('_', end='')
elif i in (4, 10, 14, 20):
print('}', end='')
elif i in (27, 35, 43):
print('|', end='')
elif i in (34, 44):
print('~', end='')
elif i == 11:
print('o', end='')
else:
print(' ', end='')
print('\n', end='') # 儿子
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment