新年要到了,今天RES的第一个博客就献给这张贺卡了qwq~~~
'''Python
# 制作一个新年贺卡
import turtle
import time
t1 = turtle.Turtle()
turtle.setup(850, 850)
turtle.bgpic('背景图片.gif') # 背景图片必须和Python文件放在同一文件夹里
turtle.register_shape('头像.gif') # 同上,选择一个你喜欢的头像吧~
t1.shape('dad.gif')
t1.penup()
turtle.tracer(False)
t1.goto(-200, -10)
turtle.update()
said = list('身体健康,阖家欢乐 ')
writer = turtle.Turtle()
writer.ht()
writer.pendown()
writer.goto(-10,0)
num = 0
for i in range(len(said) + 1):
writer.write(said[i - 1], font = ('隶书', 25))
time.sleep(0.2)
writer.penup()
writer.goto(-10, num - 25)
writer.pendown()
num -= 25
num = 100
coin = 2
## 反复横跳,不想要可以删了
while True:
if coin == 2:
t1.goto(-200, 0 - num)
time.sleep(0.2)
coin = 1
elif coin == 1:
t1.goto(-200, 0 + num)
time.sleep(0.2)
coin = 2