Commit 74c81472 by BellCodeEditor

save project

parent 9ccf1181
Showing with 19 additions and 3 deletions
...@@ -5,7 +5,7 @@ a=0 ...@@ -5,7 +5,7 @@ a=0
pygame.init() pygame.init()
screen = pygame.display.set_mode((640, 480)) screen = pygame.display.set_mode((640, 480))
my_font=pygame.font.Font("neuropol.ttf",18)
bg_img = pygame.image.load('background.png') # 背景图 bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮 play_img = pygame.image.load('play.png') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮 stop_img = pygame.image.load('stop.png') # 暂停按钮
...@@ -62,6 +62,9 @@ while True: ...@@ -62,6 +62,9 @@ while True:
num = 0 num = 0
pygame.mixer.music.load( music_list[num]) pygame.mixer.music.load( music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music=pygame.mixer.Sound(music_list[num])
ll=music.get_length()
ll=int(ll)
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -74,6 +77,9 @@ while True: ...@@ -74,6 +77,9 @@ while True:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(music_list[num]) pygame.mixer.music.load(music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music=pygame.mixer.Sound(music_list[num])
ll=music.get_length()
ll=int(ll)
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -84,17 +90,26 @@ while True: ...@@ -84,17 +90,26 @@ while True:
new_rect=new_img.get_rect(center=(320,200)) new_rect=new_img.get_rect(center=(320,200))
pos=(new_rect[0],new_rect[1]) pos=(new_rect[0],new_rect[1])
a+=1 a+=1
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( music_list[num]) pygame.mixer.music.load( music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music=pygame.mixer.Sound(music_list[num])
ll=music.get_length()
ll=int(ll)
l=pygame.mixer.music.get_pos()
l=l//1000
m=l//60
s=l%60
time=str(m)+":"+str(s)
t=my_font.render(time,True,(0,0,0))
screen.blit(bg_img, (0, 0)) screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
screen.blit(new_img,pos ) screen.blit(new_img,pos )
screen.blit(last_img, (120, 350)) screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350)) screen.blit(next_img, (420, 350))
screen.blit(t, (80, 435))
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