Commit e071f8a6 by BellCodeEditor

save project

parent 1d119d78
Showing with 54 additions and 1 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os
pygame.init() # 初始化 pygame.init() # 初始化
# 创建窗口 # 创建窗口
...@@ -13,8 +14,25 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -13,8 +14,25 @@ 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('歌曲4.ogg') pygame.mixer.music.load('歌曲4.ogg')
asssw = []
path = 'C:\\Users\\Administrator\\Desktop\\阿萨斯多'
filelist=os.listdir(path)
m = -1
click = 0
for i in filelist:
if i[-4:]=='.wav' or i[-4:]=='.ogg':
asssw.append(i)
adwaioduwqoibyoi = 0.5 adwaioduwqoibyoi = 0.5
x,y = (0,0)
play_putton = stop_img
while True: while True:
pygame.mixer.music.set_volume(adwaioduwqoibyoi) pygame.mixer.music.set_volume(adwaioduwqoibyoi)
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -29,11 +47,46 @@ while True: ...@@ -29,11 +47,46 @@ while True:
adwaioduwqoibyoi -= 0.1 adwaioduwqoibyoi -= 0.1
if adwaioduwqoibyoi < 0: if adwaioduwqoibyoi < 0:
adwaioduwqoibyoi = 0 adwaioduwqoibyoi = 0
if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1:
x,y=event.pos
if x > 270 and x<370 and y>350 and y<450:
click+=1
if click % 2==0:
play_putton = stop_img
pygame.mixer.music.unpause()
else:
play_putton = play_img
pygame.mixer.music.pause()
if event.button == 1:
x,y=event.pos
if x > 120 and x<220 and y>350 and y<400:
play_putton = stop_img
click=2
m-=1
if m<0:
m=-1
pygame.mixer.music.load(asssw[m])
pygame.mixer.music.play()
if event.button == 1:
x,y=event.pos
if x > 420 and x<520 and y>350 and y<400:
play_putton = stop_img
click=2
m+=1
if m>len(asssw)-1:
m=0
pygame.mixer.music.load(asssw[m])
pygame.mixer.music.play()
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
m+=1
if m>len(asssw)-1:
m=0
pygame.mixer.music.load(asssw[m])
pygame.mixer.music.play() pygame.mixer.music.play()
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(stop_img, (270, 330)) # 暂停按钮 screen.blit(play_putton, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图 screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
......
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