Commit 0382fd3a by BellCodeEditor

save project

parent c149dc94
import pygame
from pygame import locals
import os
pygame.init()
screen = pygame.display.set_mode((640,480))
......@@ -10,14 +11,17 @@ next = pygame.image.load('next.png')
stop = pygame.image.load('stop.png')
play = pygame.image.load('play.png')
font = pygame.font.Font('neuropol.ttf',20)
music_list = ['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
music_list = []
path = 'C:\\Users\\EDZ\\Desktop\\123'
num = -1
# pygame.mixer.music.load('test.wav')
fps = pygame.time.Clock()
volume = 0.5
click = 0
play_button = stop
pygame.mixer.music.set_volume(volume)
for file in os.listdir(path):
if file[-4:] == '.wav' or file[-4:] == '.ogg':
music_list.append(file)
while True:
for event in pygame.event.get():
......@@ -46,10 +50,10 @@ while True:
pygame.mixer.music.set_volume(volume)
if pygame.mixer.music.get_busy() == False:
sum += 1
if sum > len(music_list)-1:
sum = 0
pygame.mixer.music.load(music_list[sum])
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play()
screen.blit(background,(0,0))
......
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