Commit b0f4a673 by BellCodeEditor

save project

parent f81c3dfe
Showing with 19 additions and 3 deletions
...@@ -3,7 +3,7 @@ from pygame import locals ...@@ -3,7 +3,7 @@ from pygame import locals
import os import os
pygame.init() pygame.init()
font = pygame.font.Font("neuropol.ttf",30)
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
bg_img = pygame.image.load('background.png') # 背景图 bg_img = pygame.image.load('background.png') # 背景图
...@@ -61,6 +61,9 @@ while True: ...@@ -61,6 +61,9 @@ 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()
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
cd = int( music1.get_length() )
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -73,6 +76,9 @@ while True: ...@@ -73,6 +76,9 @@ while True:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
cd = int( music1.get_length() )
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -86,13 +92,20 @@ while True: ...@@ -86,13 +92,20 @@ while True:
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1 = pygame.mixer.Sound(path + "\\" + music_list[num])
cd = int( music1.get_length() )
playtime = pygame.mixer.music.get_pos() playtime = pygame.mixer.music.get_pos()
playtime = int( playtime / 1000 ) playtime = int( playtime / 1000 )
fen = playtime//60 fen = playtime//60
miao = playtime % 60 miao = playtime % 60
info = str(fen) + ":" + str(miao) info1 = str(fen) + ":" + str(miao)
print(info)
fen2 = cd//60
miao2 = cd % 60
info2 = str(fen2) + ":" + str(miao2)
info = info1 + "/" + info2
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))
if click%2 == 0: if click%2 == 0:
...@@ -104,5 +117,7 @@ while True: ...@@ -104,5 +117,7 @@ while True:
screen.blit(new_logo,newRect) screen.blit(new_logo,newRect)
screen.blit(last_img, (120, 350)) screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
nr = font.render(info, True,(0,0,0))
screen.blit(nr,(120,440))
pygame.display.update() 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