Commit 1012f4eb by BellCodeEditor

auto save

parent c096bad0
Showing with 7 additions and 7 deletions
......@@ -14,19 +14,18 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
music_list = []
path = "C:\\Users\\bellcode\\Desktop\\test"
filelist = os.listdir(path)
path = "C:\\Users\\James\\Desktop\\test music.wav\\"
num = -1
for i in filelist:
if i[-4:] == ".wav" or i[-4:] == ".ogg":
music_list.append(i)
for file in os.listdir(path):
if file[-4:] == ".wav" or file[-4:] == ".ogg":
music_list.append(file)
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
while True:
pygame.transform.rotate("C:\\Users\\James\\Documents\\pygame_lesson6_diy1\\long.png",10)
pygame.transform.rotate(logo_img,-10)
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
......@@ -80,8 +79,9 @@ while True:
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
if num >= len(music_list)-1:
num = 0
print(num)
pygame.mixer.music.load(path + "\\" + music_list[num])
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