Commit c5fc1c36 by BellCodeEditor

auto save

parent 890da8f3
Showing with 13 additions and 5 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -14,7 +14,12 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
ml = ['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
music_list = []
gequ="C:\\Users\\Administrator\\Desktop\\test"
filelist = os.listdir(gequ)
for i in filelist:
if i[-4:] == ".ogg" or i[-4:] == ".wav:":
music_list.append(i)
pygame.mixer.music.load('歌曲1.wav') # 载入音乐
mum=-1
volume = 0.2
......@@ -52,12 +57,15 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 120 and x <220 and y > 350 and y < 400:
num -= 1
if num < 0:
num = len(music_list) - 1
if pygame.mixer.music.get_busy() == False:
mum+=1
if mum>len(ml)-1:
if mum>len(filelist)-1:
mum=0
pygame.mixer.music.load(ml[mum])
pygame.mixer.music.load(gequ + "\\"+music_list[mum])
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