Commit b0d82e3d by BellCodeEditor

save project

parent a8afe06d
Showing with 7 additions and 4 deletions
import pygame import pygame
import os import os
k = os.listdir('C:\\Users\\DELL\\Desktop\\新建文件夹') k = 'C:\\Users\\DELL\\Desktop\\新建文件夹'
m = os.listdir(k)
for i in m:
if i[-4] == '.ogg':
music_list.append(i)
print(k) print(k)
from pygame import locals from pygame import locals
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -55,9 +58,9 @@ while True: ...@@ -55,9 +58,9 @@ while True:
num += 1 num += 1
if num <0: if num <0:
num=0 num=0
if num >len(music_list)-1:#当a>b if num >len(m)-1:#当a>b
num = 0 num = 0
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(m+'\\'+music_list[num])
pygame.mixer.music.play() 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