Commit 507587d5 by BellCodeEditor

save project

parent 69778f02
Showing with 9 additions and 2 deletions
import pygame import pygame
import os
from pygame import locals from pygame import locals
music_list=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.ogg"] music_list=[]
c=-1 c=-1
path="C:\\Users\\Administrator\\Desktop\\text"
filelist=os.listdir(path)
for file in filelist:
if file[-4:]==".wav" or file[-4:]==".ogg":
music_list.append(file)
print(music_list)
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -57,7 +64,7 @@ while True: ...@@ -57,7 +64,7 @@ while True:
c+=1 c+=1
if c>len(music_list)-1: if c>len(music_list)-1:
c=0 c=0
pygame.mixer.music.load(music_list[c]) pygame.mixer.music.load(path+"\\"+music_list[c])
pygame.mixer.music.play() pygame.mixer.music.play()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment