Commit 9ffe40c6 by BellCodeEditor

save project

parent 55705da0
Showing with 7 additions and 3 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
......@@ -12,9 +13,12 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.wav"]
music_list=[]
mun=-1
file_name=os.listdir(r"C:\Users\lenovo\Music")
for i in file_name:
if i[-4:]==".mp3" or i[-4:]==".ogg":
music_list.append(i)
pygame.mixer.music.load('歌曲4.ogg') # 载入音乐
volume = 0.2
......@@ -58,7 +62,7 @@ while True:
mun+=1
if mun>len(music_list)-1:
mun=0
pygame.mixer.music.load(music_list[mun])
pygame.mixer.music.load(r"C:\Users\lenovo\Music"+"\\"+music_list[mun])
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