Commit add7fef0 by BellCodeEditor

save project

parent 287f5ab4
Showing with 14 additions and 5 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
...@@ -12,13 +13,12 @@ last_img = pygame.image.load('last.png') # 上一曲按钮 ...@@ -12,13 +13,12 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐 # 载入音乐
pygame.mixer.music.load('歌曲4.ogg') # 载入音乐 music_list=[]
filelast=[]
path="C:\\Users\\yangyang\\Desktop\\test2" path="C:\\Users\\yangyang\\Desktop\\test2"
filelast=os.listdir(path) filelast = os.listdir(path)
for i in filelast: for i in filelast:
if i[-4:]=='ogg' or i[-4:]=="wav": if i[-4:]=='.ogg' or i[-4:]==".wav":
music_list.append(i) music_list.append(i)
num=-1 num=-1
volume = 0.2 volume = 0.2
...@@ -56,6 +56,15 @@ while True: ...@@ -56,6 +56,15 @@ while True:
else: else:
play_button = play_img play_button = play_img
pygame.mixer.music.pause() pygame.mixer.music.pause()
if x>120 and x<200 and y>350 and y<450:
num-=1
if num<0:
num=len(music_list)-1
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play()
play_button=stop_img
click=0
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num+=1 num+=1
if num>len(filelast)-1: if num>len(filelast)-1:
......
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