Commit cb05d1c2 by BellCodeEditor

save project

parent 6b12128c
[InternetShortcut]
URL=javascript:;
[InternetShortcut]
URL=javascript:;
import pygame import pygame
from pygame import locals from pygame import locals
import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
...@@ -11,11 +12,17 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮 ...@@ -11,11 +12,17 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮 last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮 next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load('M500000IDn2a2qPSCg.mp3')
volume=0.2 volume=0.2
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
music_list=[]
path="C:\\Users\\makcoo\\Desktop\\音乐"
filelist=os.listdir(path)
for i in filelist:
if i[-4:]==".url":
music_list.append(i)
num=-1
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type==locals.QUIT: if event.type==locals.QUIT:
...@@ -34,6 +41,10 @@ while True: ...@@ -34,6 +41,10 @@ while True:
pygame.mixer.music.set_volume(volume) pygame.mixer.music.set_volume(volume)
if pygame.mixer.music.get_busy() ==False: if pygame.mixer.music.get_busy() ==False:
num+=1
if num >len(music_list)-1:
num=0
pygame.mixer.music.load(path+"\\"+music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
......
[InternetShortcut]
[InternetShortcut]
URL=javascript:;
[InternetShortcut]
[InternetShortcut]
URL=javascript:;
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