Commit 50c60185 by BellCodeEditor

save project

parent 8b9aca6b
Showing with 29 additions and 9 deletions
......@@ -10,7 +10,8 @@ play_img = pygame.image.load('play.png') # 播放按钮
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') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一
font=pygame.font.Font("neuropol.ttf",16)
music=[]
# 载入音乐
D="C:\\Users\\lenovo\\Desktop\\test"
......@@ -54,27 +55,39 @@ while True:
pygame.mixer.music.unpause()
else:
play_button = play_img
pygame.mixer.music.pause()
pygame.mixer.music.pause()
if x>120 and x<220 and y>350 and y<450:
num-=1
if num<0:
num=len(music)-1
pygame.mixer.music.load(D+"\\"+music[num])
pygame.mixer.music.play()
pygame.mixer.music.play()
click=0
music1=pygame.mixer.Sound(D+"\\"+music[num])
music_length=music1.get_length()
music_length=int(music_length)
if x>420 and x<520 and y>350 and y<450:
num-=-1
if num>len(music)-1:
num=0
click=0
pygame.mixer.music.load(D+"\\"+music[num])
pygame.mixer.music.play()
click=0
pygame.mixer.music.play()
music1=pygame.mixer.Sound(D+"\\"+music[num])
music_length=music1.get_length()
music_length=int(music_length)
if pygame.mixer.music.get_busy() == False:
num+=1
if num>len(music)-1:
num=0
pygame.mixer.music.load(D+"\\"+music[num])
pygame.mixer.music.play()
music1=pygame.mixer.Sound(D+"\\"+music[num])
music_length=music1.get_length()
music_length=int(music_length)
newlogo=pygame.transform.rotate(logo_img,jd)
newRest=newlogo.get_rect(center=(320,200))
pos=(newRest[0],newRest[1])
......@@ -82,17 +95,24 @@ while True:
jd+=20
else:
pass
time=int(pygame.mixer.music.get_pos())//1000
time=int(pygame.mixer.music.get_pos()//1000)
timef=time//60
timem=time%60
timezf=music_length//60
timezm=music_length%60
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(newlogo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350))
# 下一曲
# 刷新画面
score1=font.render(str(timef)+":"+str(timem),True,(255,255,255))
screen.blit(score1,(120,440))
score2=font.render("/"+str(timezf)+":"+str(timezm),True,(255,255,255))
screen.blit(score2,(170,440))
pygame.display.update()
print(str(timef)+":"+str(timem))
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