Commit 4b47c6a2 by BellCodeEditor

save project

parent ab8dc4b6
Showing with 10 additions and 12 deletions
import pygame
from pygame import locals
import os
from pygame import locals
files=os.listdir("C:\\Users\\Administrator\\Desktop\\新建文件夹")
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -14,12 +14,13 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
volume = 0.5
# 载入音乐
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
#path=os.listdir("C:\\Users\\Administrator\\Desktop\\Music")
path=os.listdir("C:\\Users\\Administrator\\Documents\\pygame_lesson5_diy2")
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -52,14 +53,11 @@ while True:
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False:
for j in path:
#if j[-4:] == ".mp3":
if j[-4:] == ".wav":
print(j)
#pygame.mixer.music.load("C:\\Users\\Administrator\\Desktop\\Music"+"\\"+j) # 载入音乐
pygame.mixer.music.load("C:\\Users\\Administrator\\Documents\\pygame_lesson5_diy2"+"\\"+j) # 载入音乐
for i in files:
if i[-4:]==".mp3" or ".wav" or ".ogg":
pygame.mixer.music.load(i)
pygame.mixer.music.play()
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
......
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