Commit 3b97ccdf by BellCodeEditor

save project

parent 022efc42
Showing with 15 additions and 5 deletions
......@@ -3,10 +3,8 @@ from pygame import locals
import os
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
# 载入图片、资源
pygame.init() # 初始化# 创建窗口
screen = pygame.display.set_mode((640, 480))# 载入图片、资源
bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮
......@@ -14,7 +12,6 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
pygame.mixer.music.load('歌曲1.wav')
pygame.mixer.music.load('歌曲2.wav')
pygame.mixer.music.load('歌曲3.wav')
......@@ -27,6 +24,7 @@ nu = -1
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
play_button = stop_img
path = str(fl)
while True:
for event in pygame.event.get():
......@@ -58,6 +56,18 @@ while True:
else:
play_button = play_img
pygame.mixer.music.pause()
if x > 120 and x < 220 and y > 350 and y < 450:
nu -= 1
if nu < 0:
un = len(fl)-1
pygame.mixer.music.load(path + "\\" + fl[nu])
pygame.mixer.music.play()
if x > 420 and x < 520 and y > 350 and y < 450:
nu += 1
if nu > 3:
un = 0
pygame.mixer.music.load(path + "\\" + fl[nu])
pygame.mixer.music.play()
nu += 1
if nu > len(fl)-1:
nu = 0
......
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