Commit 1746be4f by BellCodeEditor

save project

parent 2ed2db7f
Showing with 8 additions and 3 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -13,8 +13,13 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
volume = 0.1
pygame.mixer.music.set_volume(volume)
music_list=["M500000IDn2a2qPSCg.mp3","M5000023FqLy3lZYI0.mp3","毛不易 - 给你给我 (1).mp3","声声慢 - 崔开潮.mp3"]
music_list = []
path = "C:\\Users\\cc\\Desktop\\音乐"
filelist = os.listdir(path)
num=-1
for i in filelist:
if i[-4:] == ".mp3":
music_list.append(i)
while True:
for event in pygame.event.get():
......@@ -35,7 +40,7 @@ while True:
num+=1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(music_list[num])
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play()
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(stop_img, (270, 330)) # 暂停按钮
......
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