Commit 48e2dba7 by BellCodeEditor

save project

parent 92784738
Showing with 138 additions and 7 deletions
import pygame
import os
from pygame import locals
pygame.init() # 初始化
......@@ -12,16 +13,20 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
aa = ['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg',]# 载入音乐
a=-1
aa = []# 载入音乐
path='C:\\Users\\student\\Desktop\\0'
filelist = os.listdir(path)
for i in filelist:
if i[-4:]=='.ogg' or i[-4:]=='.wav':
aa.append(i)
while True:
# 载入音乐
volume =3
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
while True:
for event in pygame.event.get():
......@@ -58,7 +63,7 @@ while True:
a+=1
if a>len(aa)-1:
a=0
pygame.mixer.music.load(aa[a])
pygame.mixer.music.load(path+'\\'+aa[a])
pygame.mixer.music.play()
# 绘制画面
......@@ -69,3 +74,129 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
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