Commit b1c673c5 by BellCodeEditor

save project

parent 4a550402
Showing with 31 additions and 6 deletions
......@@ -11,11 +11,11 @@ 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') # 下一曲按钮
my_font=pygame.font.Font("neuropol.ttf",12)
# 载入音乐
# 载入音乐
music_list = []
path='C:\\Users\\Administrator\\Desktop\\新建文件夹'
path='C:\\Users\\Administrator\\Desktop\\m'
filelist=os.listdir(path)
for i in filelist:
if i[-4:]==".wav" or i[-4:]==".mp3":
......@@ -67,6 +67,11 @@ while True:
pygame.mixer.music.play()
click=0
play_button=stop_img
music1=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = music1.get_length()
music_length =int(music_length)
if x > 420 and x <520 and y > 350 and y < 400:
num+=1
if num==len(music_list):
......@@ -75,7 +80,9 @@ while True:
pygame.mixer.music.play()
click=0
play_button=stop_img
music1=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = music1.get_length()
music_length =int(music_length)
if pygame.mixer.music.get_busy() == False:
num+=1
......@@ -83,16 +90,34 @@ while True:
num=0
pygame.mixer.music.load(path+'\\'+music_list[num])
pygame.mixer.music.play()
music1=pygame.mixer.Sound(path+'\\'+music_list[num])
music_length = music1.get_length()
music_length =int(music_length)
play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000)
play_m=play_time//60
play_s=play_time%60
info=str(play_m)+":"+str(play_s)
music_m=play_time//60
music_s=play_time%60
info2=str(play_m)+":"+str(play_s)
n_logo=pygame.transform.rotate(logo_img,angle)
newRect=n_logo.get_rect(center=(320,200))
pos=newRect[0],newRect[1]
angle+=1
if play_button == stop_img:
angle+=1
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(n_logo, (pos)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(next_img, (420, 350))
text=my_font.render(info,True,(255,255,255))
screen.blit(text,(120,440))
text2=my_font.render("/"+info2,True,(255,255,255))
screen.blit(text2,(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