Commit 9d2f2a8f by BellCodeEditor

save project

parent f5ef4362
Showing with 9 additions and 3 deletions
import pygame
import pygame,os
from pygame import locals
pygame.init() # 初始化
......@@ -12,8 +12,14 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
a=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.wav']
a=[]
b=-1
c='C:\\Users\\Ding\\Desktop\\音乐播放器'
d=os.listdir(c)
for i in d:
if i[-3:]=='wav' or i[-3:]=='ogg':
a.append(i)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
......@@ -55,7 +61,7 @@ while True:
b+=1
if b>len(a)-1:
b=0
pygame.mixer.music.load(a[b])
pygame.mixer.music.load(c+'\\'+a[b])
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