turtle小女孩跳舞多媒体动画_scratch程序改编python程序

"""python小女孩跳舞多媒体动画_婷婷的舞蹈,scratch程序改编python程序"""

from turtle import *
from winsound import PlaySound,SND_ASYNC

# 背景列表
background_list = ["b0.png","b1.png","b2.png","b3.png","b4.png","b5.png","b6.png","b7.png"]
bgamount = len(background_list)                   #背景数量
girls_list = ["girl0.gif","girl1.gif","girl2.gif","girl3.gif"]
gamount = len(girls_list)          # 女孩造型数量

s = Screen()
s.setup(480,360)
s.title("婷婷的舞蹈_python海龟画图版by李兴球")

for item in girls_list:            # 每个图片都加到形状列表
    s.addshape(item)

index = 0
def change_background():
    global index
    s.bgpic(background_list[index])
    index = index + 1
    index = index % bgamount
    s.ontimer(change_background,500)
change_background()

t = Turtle(shape = "girl0.gif")
i = 0
def switch_costume():
    global i
    t.shape(girls_list[i])
    i =  i + 1
    i = i % gamount
    s.ontimer(switch_costume,450)
switch_costume()


def play_music():
    PlaySound("Cave.wav",SND_ASYNC)
    s.ontimer(play_music,7300)
play_music()

s.mainloop()

python小女孩跳舞多媒体动画_婷婷的舞蹈,scratch程序改编python程序www.lixingqiu.com