Commit e348179a by BellCodeEditor

save project

parent 0736b0b2
Showing with 9 additions and 5 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -13,9 +13,12 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
music_list=['1.mp3','2.wav','3.wav','4.wav','5.ogg']
pygame.mixer.music.load('5.ogg') # 载入音乐
music_list=[]
file_name=os.listdir(r'C:\Users\Administrator\Desktop')
for i in file_name:
if i[-4:]==".ogg"or i[-4:]==".mp3"or i[-4:]==".wav":
music_list.append(i)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
......@@ -53,7 +56,8 @@ while True:
mun+=1
if mun>len(music_list)-1:
mun-=1
pygame.mixer.music.load(music_list[mun])
pygame.mixer.music.load(r'C:\Users\Administrator\Desktop'+"\\"+music_list[mun])
pygame.mixer.music.play()
......
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