Commit 477e714e by BellCodeEditor

save project

parent 08d0f544
Showing with 8 additions and 2 deletions
import pygame
import os
from pygame import locals
pygame.init() # 初始化
......@@ -11,12 +12,17 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
music=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
music=[]
n=-1
v=0.2
pygame.mixer.music.set_volume(v)
c=0
p=stop_img
path='C:\\Users\\dell\\Desktop\\test'
f=os.listdir(path)
for i in f:
if i[-4:]=='.ogg' or i[-4:]=='.wav':
music.append(i)
while True:
for event in pygame.event.get():
......@@ -26,7 +32,7 @@ while True:
n+=1
if n>len(music)-1:
n=0
pygame.mixer.music.load(music[n])
pygame.mixer.music.load(path+'\\'+music[n])
pygame.mixer.music.play()
if event.type==locals.KEYDOWN:
if event.key==locals.K_UP:
......
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