Commit 681df1c4 by BellCodeEditor

save project

parent 0415c7a7
Showing with 9 additions and 5 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
...@@ -14,8 +15,11 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮 ...@@ -14,8 +15,11 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
num=-1 num=-1
p=[] p=[]
zppp= pp='C:\\Users\\Think\\Desktop\\nb'
# 载入音乐 ppp=os.listdir(pp)
for pppp in ppp:
if pppp[-4:]==".wav" or pppp[-4:]==".ogg":
p.insert(0,pppp)
volume = 0.2 volume = 0.2
...@@ -59,18 +63,18 @@ while True: ...@@ -59,18 +63,18 @@ while True:
pygame.mixer.music.pause() pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
if
num+=1 num+=1
if num<len(p)-1: if num<len(p)-1:
pygame.mixer.music.load(p[num]) pygame.mixer.music.load(ppp+"\\"+p[num])
pygame.mixer.music.play() pygame.mixer.music.play()
if num==len(p)-1: if num==len(p)-1:
num=0 num=0
pygame.mixer.music.load(p[num]) pygame.mixer.music.load(ppp+"\\"+p[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