Commit f7c34299 by BellCodeEditor

save project

parent 4c30b839
Showing with 19 additions and 2 deletions
import pygame import pygame
import os
from pygame import locals from pygame import locals
pygame.init() pygame.init()
...@@ -16,7 +17,18 @@ volume = 0.2 ...@@ -16,7 +17,18 @@ volume = 0.2
pygame.mixer.music.load('歌曲4.ogg') pygame.mixer.music.load('歌曲4.ogg')
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
click=0 click=0
music_list=[]
play_button = stop_img play_button = stop_img
path='C:\\Users\\Administrator\\Desktop\\新建文件夹 (2)'
filelist=os.listdir(path)
for file in filelist:
if file[-4:] == '.wav'or file[-4:]=='.ogg':
music_list.append(file)
num=-1 num=-1
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -46,7 +58,7 @@ while True: ...@@ -46,7 +58,7 @@ while True:
num+=1 num+=1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(path+'\\'+music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
...@@ -57,5 +69,5 @@ while True: ...@@ -57,5 +69,5 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ No newline at end of file
import os
filelist = os.listdir('C:\\Users\\Administrator\\Desktop\\新建文件夹 (2)')
print(filelist)
\ No newline at end of file
No preview for this file type
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