Commit 017d1514 by BellCodeEditor

save project

parent b95b291a
Showing with 9 additions and 8 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -13,20 +12,22 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
# 载入音乐
m=[]
# 载入音乐 # 载入音乐
h="C:\\Users\\lenovo\Desktop\\新建文件夹 (2)"
fillelist=os.listdir(h)
for i in fillelist:
if i[-4:]==".wav"or i[-4:]==".ogg":
u=-1
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
while True:
for i in fillelist:
if i[-4:]!=".wav"and i[-4:]!=".ogg":
u+=1
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
......@@ -59,9 +60,9 @@ while True:
if pygame.mixer.music.get_busy() == False:
u+=1
if u > len(m)-1:
if u > len(fillelist)-1:
u=0
pygame.mixer.music.load(p+"\\"+m[u])
pygame.mixer.music.load(h+"\\"+fillelist[u])
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