Python 精灵模块制作的月满西楼李清照词 MV

视频查看网址:
http://www.lixingqiu.com/2019/12/31/%e6%9c%88%e6%bb%a1%e8%a5%bf%e6%a5%bcmv/

"""
   月满西楼mv.py
   本程序是一幅多媒体动画.

"""
__author__ = "李兴球"
__date__ = "2019年12月26日"

import time,os

from sprites import *

class Star(Sprite):
    def __init__(self,x,y):
        Sprite.__init__(self,shape='star',visible=False,pos=(x,y))
        self.cs = ['gray','white']
        self.se = [0.15,0.16]
        self.index = 0        
        self.show()
        self.flash()

    def flash(self):
        """闪烁"""
        self.index = 1 - self.index
        self.color(self.cs[self.index])
        self.scale(self.se[self.index])
        t = random.randint(800,1200)
        self.screen.ontimer(self.flash,t)        

project_name = '月满西楼'
width,height = 600,600
screen = Screen()
screen.bgcolor('dodger blue')
screen.setup(width,height) 
screen.title(project_name)
screen.bgpic('荷塘月夜-唯美浪漫.png')

cors = [(0,250),(100,230),(-100,230),(-10,20),(30,50),(150,150),
        (-200,10),(-150,150),(-100,90),(250,130),(220,220),(100,90)]
for x,y in cors:Star(x,y)

# 显示标题,在一定时间后会自动清除
w = Sprite(visible=False,shape='title0.png')
w.addy(250)
w.stamp(60)
w.shape('title1.png')
w.addy(-220)
w.stamp(60)

tom = Turtle(visible=False)
tom.color("blue","white")
song_file="邓丽君-月满西楼.wav"    # 歌曲文件
lrc_file="月满西楼歌词.txt"        # 歌词文件
fontstyle = ("",24,"normal")  
tom.play(song_file,lrc_file,fontstyle)

screen.mainloop()
本作品采用《CC 协议》,转载必须注明作者和本文链接
python精灵模块
scratch
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!