Commit 9800045f by BellCodeEditor

auto save

parent ffdc3ca4
Showing with 15 additions and 4 deletions
......@@ -3,7 +3,8 @@ from pygame import locals
import os
pygame.init()
mt=pygame.mixer.Sound(few1.p)
mn=pygame.mixer.Sound(fe)
screen = pygame.display.set_mode((640, 480))
bg_img = pygame.image.load('background.png') # 背景图
......@@ -12,7 +13,8 @@ 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') # 下一曲按钮
mno=mn.get_lenght()
mto=mt.get_lenght()
music_list = []
path = "C:\\Users\\Administrator\\Desktop\\tast"
filelist = os.listdir(path)
......@@ -76,17 +78,25 @@ while True:
click += 2
else:
click += 1
mt=pygame.mixer.music.Sound(path + "\\" + music_list[num])
mto=mt.get_lenght()
mto=int(mto)
if pygame.mixer.music.get_busy() == False:
num += 1
if num > len(music_list)-1:
num = 0
pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play()
mt=pygame.mixer.music.Sound(path + "\\" + music_list[num])
mto=mt.get_lenght()
mto=int(mto)
play_time=pygame.mixer.music.get_pos()
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)
ScoreSurf=basic_font.render(info,True,(255,255,255))
screen.blit(ScoreSurf,(120,440))
......@@ -101,5 +111,5 @@ while True:
screen.blit(logo_img, pos)
screen.blit(last_img, (120, 350))
screen.blit(next_img, (420, 350))
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