Commit ca8cc2d6 by BellCodeEditor

save project

parent c1753fec
Showing with 9 additions and 2 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
......@@ -12,8 +13,14 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
mu=[]
path='C:\\Users\\lvqv\\Desktop\\test'
n=-1
f=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
f=os.listdir(path)
for i in f:
if i[-4:]=='.ogg' or i[-4:]=='.wav':
mu.append(i)
v = 0.8
pygame.mixer.music.set_volume(v)
c = 0
......@@ -52,7 +59,7 @@ while True:
n+=1
if n>len(f)-1:
n=0
pygame.mixer.music.load(f[n])
pygame.mixer.music.load(path+'\\'+mu[n])
pygame.mixer.music.play()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
......
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