Commit 498b63a7 by BellCodeEditor

auto save

parent 24e14683
Showing with 31 additions and 12 deletions
import pygame
import os
from pygame import locals
pygame.init() # 初始化
......@@ -14,10 +15,16 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
volume = 0.2
pygame.mixer.music.set_volume(volume) # 初始播放音量
click = 0
click = 1
play_button = stop_img
music_list = ["歌曲1.wav","全素妍.mp3","植松伸夫.mp3","Dmitri.mp3"]
path = "C:\\Users\\ColaMaster\\Music\\"
temp_list = os.listdir(path)
music_list = []
for i in temp_list:
if i[-4:] == ".mp3":
music_list.append(i)
print(music_list)
num = 0
while True:
for event in pygame.event.get():
......@@ -42,17 +49,29 @@ while True:
x,y = event.pos
if x > 270 and x <370 and y > 350 and y < 450:
# 次数增加
click += 1
if click % 2 == 0:
play_button = stop_img
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
click = 0-click
if x>120 and x<220 and y>350 and y<400:
click = 1
num -= 1
if num < 0:
num = len(music_list)-1
pygame.mixer.music.load(path+music_list[num])
pygame.mixer.music.play()
if x>420 and x<520 and y>350 and y<400:
click = 1
num = (num+1)%3
pygame.mixer.music.load(path+music_list[num])
pygame.mixer.music.play()
if click == 1:
play_button = stop_img
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
if pygame.mixer.music.get_busy() == False:
num = (num+1)%4
pygame.mixer.music.load(music_list[num])
num = (num+1)%3
pygame.mixer.music.load(path+music_list[num])
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