Commit 11c33991 by BellCodeEditor

save project

parent 4d4d98e1
Showing with 33 additions and 2 deletions
......@@ -12,7 +12,7 @@ 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') # 下一曲按钮
my_font = pygame.font.Font('neuropol.ttf', 18)
music_list = []
path = "C:\\Users\\pc\\Desktop\\py\\新建文件夹"
filelist = os.listdir(path)
......@@ -44,7 +44,28 @@ while True:
if volume < 0:
volume = 0
pygame.mixer.music.set_volume(volume)
if event.key == locals.K_d:
num += 1
if num > len(music_list) - 1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
click += 2
else:
click += 1
if event.key == locals.K_a:
num -= 1
if num < 0:
num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
play_button = stop_img
if click % 2 == 0:
click += 2
else:
click += 1
if event.type == locals.MOUSEBUTTONDOWN:
if event.button == 1: # 左击
x, y = event.pos
......@@ -79,6 +100,13 @@ while True:
click += 2
else:
click += 1
s=pygame.mixer.music.get_pos()
s=s//1000
s_m=s//60
s_s=s%60
into=str(s_m)+':'+str(s_s)
text = my_font.render(into, True, (0, 0, 0))
if pygame.mixer.music.get_busy() == False:
num += 1
......@@ -95,10 +123,12 @@ while True:
# 绘制画面
screen.blit(bg_img,(0, 0)) # 填充背景
screen.blit(play_button,(270, 330)) # 暂停按钮
screen.blit(ss,(x1, y1)) # 中间logo图
screen.blit(last_img,(120, 350)) # 上一曲
screen.blit(next_img,(420, 350)) # 下一曲
screen.blit(text, (130, 450))
# 刷新画
pygame.display.update()
\ No newline at end of file
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