A poem for the little princess - flash screen writing (Python implementation)

content

1 The most beautiful confession poem, stunning for thousands of years

2 nice day

3 Feng Qiuhuang/Sima Xiangru - Python code implementation


1 The most beautiful confession poem, stunning for thousands of years

Zhuo Wenjun, a beautiful and intelligent woman who is good at poetry and prose, and is good at playing the piano. At the age of seventeen, she was a widow in her parents' home. One day during the banquet, just because of Sima Xiangru's song "Phoenix Begging the Phoenix", the passionate and bold confession made Zhuo Wenjun, who has long admired Sima Xiangru's talent, fell in love.

Feng Qiuhuang/Sima Xiangru

There are beauties, you will never forget them,

I haven't seen you for a day, thinking like crazy.

The phoenix is ​​soaring, seeking the phoenix from all over the world,

Helpless beauty, not in the east wall.

Substitute the piano for words, chat and write heartfelt,

Wish to match virtue, hand in hand.

When will you see Xu Xi, comfort me,

Not to fly, make me perish.

I liked this poem very much and gave it to the little princess. I haven't seen it for a day, and I miss it so much, so I can only express this poem in my head.

2 nice day

Although the flowers on the campus were blown off by the strong wind and rain a few days ago, because of her existence, it is enough to reach the spring scenery in the garden, so the campus is still beautiful and fragrant... I took her with me We studied together for a long time until it was dark. I could tell that she was very tired, but she told me that she was very happy and that I was very happy today. My schoolbag and computer were also very beautiful. It was a great day, worth remembering!

I wish to win the heart of one person, and the hands will not be separated.

3 ​​​​​​​Feng Qiuhuang /Sima Xiangru - Python code implementation

Flash Screen & Miss Poem

 

code  

import turtle
from turtle import *
import random
import time
turtle.title('凤求凰')
str_ = """
有美人兮,见之不忘,

一日不见兮,思之如狂。

凤飞遨翔兮,四海求凰,

无奈佳人兮,不在东墙。

将琴代语兮,聊写衷肠,

愿言配德兮,携手相将。

何时见许兮,慰我旁徨,

不得于飞兮,使我沦亡。
""".split("。")
setup(1280, 720)  # 设置窗口大小
colormode(255)  # 使用的颜色模式, 整数还是小数
up()
a, b = -500, 280
goto(a, b)
bgcolor("black")
down()

def w(str_, b):
    bgcolor(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))  # 随机生成RGB值, 每次调用函数改变背景颜色
    for i in range(len(str_)):
        up()
        goto(a + 100 * i, b)
        down()
        size = random.randint(12, 68)  # 随机字体大小
        color(random.randint(0, 255), random.randint(0, 255), random.randint(0, 255))  # 随机字体颜色
        write(str_[i], align="center", font=("楷体", size))


for k in range(4):
    for i in range(7):
        w(str_[i + 7 * k], b - 100 * i)
    reset()  # 清屏

for i in range(7):
    w(str_[i + 7 * 4], b - 100 * i)
up()
color("#262626;")
goto(-600, 300)
write('Author:Mifen', font=("微软雅黑", 18))
goto(-600, 250)
write('E-mail :[email protected]', font=("微软雅黑", 18))
goto(-600, 200)
write('Code :https://github.com/Amd794/Python123', font=("微软雅黑", 18))
goto(-600, -350)
down()
ht()

Guess you like

Origin blog.csdn.net/weixin_46039719/article/details/123623116