Commit 48ae9f70 by BellCodeEditor

save project

parent 235aa387
Showing with 14 additions and 4 deletions
import pygame
from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
......@@ -11,18 +11,24 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
pygame.mixer.music.load("歌曲1.wav")
v=0.2
c=0
a=[]
mum=-1
path="C:\\Users\\PC\\Desktop\\a1"
filelist=os.listdir(path)
for i in filelist:
if i[-4:]==".ogg" or i[-4:]==".wav":
a.append(i)
pygame.mixer.music.set_volume(v)
while True:
for event in pygame.event.get():
if event.type==locals.MOUSEBUTTONDOWN:
if event.button==1:
x,y=event.pos
if x>270 and x<370 and y>350 andy<450
if x>270 and x<370 and y>350 and y<450:
c=c+1
if c%2==0
if c%2==0:
play_button=stop_img
pygame.mixer.music.unpause()
else:
......@@ -42,6 +48,10 @@ while True:
v=1
pygame.mixer.music.set_volume(v)
if pygame.mixer.music.get_busy()==False:
mum=mum+1
if mum>len(filelist)-1:
mum=0
pygame.mixer_music.load(path+"\\"+a[mum])
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