0
点赞
收藏
分享

微信扫一扫

【Python春联生成器】春节临近,旧岁将辞,你家的春联和“福”字安排上了吗?

前言

正文

春节临近,旧岁将辞,你家的春联和“福”字安排上了吗?

今天小编给大家写一款简单的新年春联,希望大家喜欢啦

一、效果展示

 二、源码展示

from turtle import *

bgcolor("lightsalmon")
pensize(5)
setup(1400, 1000)
update()

fillcolor("chocolate")
pencolor("brown")

pu()
goto(-330, 200)
seth(-90)
pd()

begin_fill()
for i in range(2):
    fd(560)
    left(90)
    fd(180)
    left(90)
end_fill()

pu()
goto(-150, 200)
seth(-90)
pd()

begin_fill()
for i in range(2):
    fd(560)
    left(90)
    fd(180)
    left(90)
end_fill()

fillcolor("lightsalmon")

pu()
goto(-150, -80)
seth(180)
fd(40)
right(90)
pd()

begin_fill()
circle(20)
end_fill()

pu()
seth(0)
fd(80)
right(90)
pd()

begin_fill()
circle(20)
end_fill()

fillcolor("red")
pencolor("firebrick2")

pu()
goto(-330, 250)
seth(0)
pd()

begin_fill()
for i in range(2):
    fd(360)
    left(90)
    fd(100)
    left(90)
end_fill()

pencolor("black")
pu()

texts = ["安", "国", "泰", "民"]
for text in texts:
    fd(72)
    write(text, align="center", font=("华文行楷", 60, "normal"))

pencolor("firebrick2")

goto(-380, 200)
seth(180)
pd()

begin_fill()
for i in range(2):
    fd(100)
    left(90)
    fd(560)
    left(90)
end_fill()

pu()
goto(-430, 200)
pencolor("black")
seth(-90)

texts = "民安国泰逢盛世"
for text in texts:
    fd(80)
    write(text, align="center", font=("华文行楷", 60, "normal"))

pencolor("firebrick2")
goto(180, 200)
seth(180)
pd()

begin_fill()
for i in range(2):
    fd(100)
    left(90)
    fd(560)
    left(90)
end_fill()

pu()
goto(130, 200)
pencolor("black")
seth(-90)

texts = "风调雨顺颂华年"
for text in texts:
    fd(80)
    write(text, align="center", font=("华文行楷", 60, "normal"))

# snowman

pencolor("black")
pensize(2)
fillcolor("white")

pu()
goto(400, -100)
seth(0)
pd()

begin_fill()
circle(65)
end_fill()

begin_fill()
circle(-105)
end_fill()

pensize(6)

pu()
goto(355, -10)
seth(50)
pd()

circle(-25, 100)

pu()
goto(355, -40)
seth(-45)
pd()

fillcolor("orange")
pensize(3)

begin_fill()
circle(-15, 90)
goto(295, -55)
goto(355, -40)
end_fill()

pu()
goto(400, -100)
seth(-90)

colors = ["red", "orange", "blue", "green"]
for i in range(4):
    fd(42)
    dot(20, colors[i])

pensize(3)

goto(420, -150)
seth(-75)
pd()

fd(100)
right(20)
for i in range(3):
    fd(30)
    bk(30)
    left(20)

fillcolor("black")
pencolor("black")
pensize(3)


def shape1(pos):
    pu()
    goto(pos)
    seth(115)
    pd()

    begin_fill()
    circle(5)
    end_fill()

    fd(40)
    right(80)
    fd(60)
    right(100)
    fd(40)

    begin_fill()
    circle(-5)
    end_fill()


def shape2(pos):
    pu()
    goto(pos)
    seth(60)
    pd()

    begin_fill()
    circle(5)
    end_fill()

    fd(40)
    right(180)
    circle(20, 40)
    circle(-20, 45)


def shape3(pos):
    pu()
    goto(pos)
    seth(90)
    pd()

    begin_fill()
    circle(5)
    end_fill()

    fd(45)


shape1((200, 280))
shape2((300, 240))
shape3((340, 180))

shape3((-400, 320))
shape2((-480, 280))
shape1((-455, 380))

总结

新的一年祝大家:

恭喜发财、一帆风顺、富贵双全、双喜临门、

五福临门、六六大顺、十全十美、万事如意、

福满门庭、万福临门心想事成、吉星高照、

福满人间、喜气临门、吉祥如意、万事亨通、

万象更新、合家欢乐 鹏程万里、门迎百福、

瑞气盈门、旭日东升、和气生财、财源广进、

出入平安、新年快乐、欣欣向荣 美满幸福、

和气致祥、鸾凤和鸣、喜气盈门、招财进宝、

福星高照、福禄寿禧、荣华富贵!

关注小编获取更多精彩内容!记得点击传送门哈👇

记得三连哦! 如需打包好的源码+素材免费分享滴!传送门

举报

相关推荐

0 条评论