Commit 5b621ff5 by BellCodeEditor

save project

parent cd856032
Showing with 11 additions and 2 deletions
...@@ -28,6 +28,7 @@ click = 0 ...@@ -28,6 +28,7 @@ click = 0
play_button = stop_img play_button = stop_img
angel=1 angel=1
while True: while True:
music1=pygame.mixer.Sound(path+"\\"+filelist[num])
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
exit() exit()
...@@ -66,6 +67,8 @@ while True: ...@@ -66,6 +67,8 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
lenth=music1.get_length()
lenth=int(lenth)
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
...@@ -78,6 +81,8 @@ while True: ...@@ -78,6 +81,8 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
lenth=music1.get_length()
lenth=int(lenth)
if click%2==0: if click%2==0:
...@@ -91,14 +96,18 @@ while True: ...@@ -91,14 +96,18 @@ while True:
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()
lenth=music1.get_length()
lenth=int(lenth)
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)
play_m=play_time//60 play_m=play_time//60
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) info2=lenth
info3=info+"/"+str(info2)
my_font= pygame.font.Font('neuropol.ttf',18) my_font= pygame.font.Font('neuropol.ttf',18)
text=my_font.render(info,True,(0,0,0)) text=my_font.render(info3,True,(0,0,0))
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 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