Commit dcb0866d by BellCodeEditor

save project

parent 2fd23886
Showing with 41 additions and 8 deletions
......@@ -11,16 +11,13 @@ 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
pygame.mixer.music.load('歌曲4.ogg')
basic_font=pygame.font.Font("neuropol.ttf",14)
w = []
qq="C:\\Users\\86130\\Desktop\\text"
l=os.listdir(qq)
for i in l:
if i[-4:]==".wav" or i[-4:]==".ogg":
w.append(i)
angle=0
a=0.2
pygame.mixer.music.set_volume(a)
......@@ -28,9 +25,9 @@ ades = 2
b = stop_img
x,y = (0,0)
m = -1
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
exit()
if event.type==locals.KEYDOWN:
......@@ -45,23 +42,49 @@ while True:
a=0
pygame.mixer.music.set_volume(a)
if event.type == locals.MOUSEBUTTONDOWN:
if event.button==1:
x,y=event.pos
if x>270 and x<370 and y >350 and y<450:
ades += 1
if ades % 2 == 1:
pygame.mixer.music.pause()
b = play_img
pygame.mixer.music.pause()
else:
b = stop_img
pygame.mixer.music.unpause()
if x>420 and x<520 and y>350 and y<400:
m=m+1
if m>len(w)-1:
m=0
print(len(w))
pygame.mixer.music.load(qq+"\\"+w[m])
pygame.mixer.music.play()
ades=0
b = stop_img
if x>120 and y>350 and x<520 and y>240 and y<400:
info=str(play_m)+":"+str(play_s)
music=pygame.mixer.Sound(qq+"\\"+w[m])
music1=music.get_length()
music1=int(music1)
musics=music1%60
musicm=music1//60
info2=str(musicm)+":"+str(musics)
newRect=new_logo.get_rect(center=(320,200))
if x>120 and x<220 and y>350 and y<400:
m=m-1
if m<0:
m=len(w)-1
pygame.mixer.music.load(qq+"\\"+w[m])
pygame.mixer.music.play()
ades=0
b = stop_img
b = stop_img
info=str(play_m)+":"+str(play_s)
music=pygame.mixer.Sound(qq+"\\"+w[m])
music1=music.get_length()
music1=int(music1)
musics=music1%60
musicm=music1//60
info2=str(musicm)+":"+str(musics)
newRect=new_logo.get_rect(center=(320,200))
if pygame.mixer.music.get_busy()==False:
m += 1
if m > len(w)-1:
......@@ -73,7 +96,15 @@ while True:
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
if play_s<10:
play_s="0"+str(play_s)
info=str(play_m)+":"+str(play_s)
music=pygame.mixer.Sound(qq+"\\"+w[m])
music1=music.get_length()
music1=int(music1)
musics=music1%60
musicm=music1//60
info2=str(musicm)+":"+str(musics)
newRect=new_logo.get_rect(center=(320,200))
if ades%2==0:
angle+=1
......@@ -85,5 +116,7 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲
scoreSurf=basic_font.render(info,True,(255,255,255))
screen.blit(scoreSurf,(120,440))
scoreSurf2=basic_font.render("/"+info2,True,(0,0,0))
screen.blit(scoreSurf2,(170,440))
# 刷新画面
pygame.display.update()
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