Commit 5647e917 by BellCodeEditor

save project

parent 92a1b7fc
Showing with 19 additions and 7 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import os import os
...@@ -64,7 +64,9 @@ while True: ...@@ -64,7 +64,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
musicl = pygame.mixer.Sound(path + "\\" + music_list[num])
music_length = musicl.get_length()
music_length = int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲 if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1 num -= 1
if num < 0: if num < 0:
...@@ -76,13 +78,19 @@ while True: ...@@ -76,13 +78,19 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
musicl = pygame.mixer.Sound(path + "\\" + music_list[num])
music_length = musicl.get_length()
music_length = int(music_length)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
if num > len(music_list)-1: if num > len(music_list)-1:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
musicl = pygame.mixer.Sound(path + "\\" + music_list[num])
music_length = musicl.get_length()
music_length = int(music_length)
play_time=pygame.mixer.music.get_pos() play_time=pygame.mixer.music.get_pos()
play_time = int(play_time/1000) play_time = int(play_time/1000)
...@@ -91,6 +99,10 @@ while True: ...@@ -91,6 +99,10 @@ while True:
play_s=play_time%60 play_s=play_time%60
info=str(play_m)+":"+str(play_s) info=str(play_m)+":"+str(play_s)
# print("进度:"+info) # print("进度:"+info)
music_m=play_time//60
music_s=play_time%60
info2=str(music_m)+":"+str(music_s)
new_logo = pygame.transform.rotate(logo_img,angle) new_logo = pygame.transform.rotate(logo_img,angle)
newRect = new_logo.get_rect(center=(320,200)) newRect = new_logo.get_rect(center=(320,200))
pos = (newRect[0],newRect[1]) pos = (newRect[0],newRect[1])
...@@ -109,6 +121,6 @@ while True: ...@@ -109,6 +121,6 @@ while True:
pygame.display.update() pygame.display.update()
FPS.tick(60) FPS.tick(60)
# #musicl = pygame.mixer.Sound(path + "\\" + music_list[num])
#music_length = musicl.get_length()
# #music_length = int(music_length)
\ No newline at end of file \ 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