Commit 1ac651cb by BellCodeEditor

save project

parent 05298656
Showing with 10 additions and 4 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -11,11 +11,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
d=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.wav"]
#d=["歌曲1.wav","歌曲2.wav","歌曲3.wav","歌曲4.wav"]
a=1
b=0
c=stop_img
e=-1
h=[]
f="C:\\Users\\EDZ\\Desktop\\test"
g=os.listdir(f)
for i in g:
if i[-4:]==".wav" or i[-4:]==".ogg":
h.append(i)
pygame.mixer.music.set_volume(a)
while True:
for event in pygame.event.get():
......@@ -25,9 +31,9 @@ while True:
exit()
if pygame.mixer.music.get_busy() == False:
e+=1
if e>len(d)-1:
if e>len(h)-1:
e=0
pygame.mixer.music.load(d[e])
pygame.mixer.music.load(f+"\\"+h[e])
pygame.mixer.music.play()
if event.type==locals.KEYDOWN:
if event.key==locals.K_DOWN:
......
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