Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / pygame_lesson6_diy2

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 423b67de authored 3 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent a5396bc9
Hide whitespace changes
Inline Side-by-side
Showing with 15 additions and 1 deletions
  • my_music.py
my_music.py
View file @ 423b67de
......@@ -14,6 +14,8 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮
fo=pygame.font.Font('neuropol.ttf',14)
music_list=[]
path = "C:\\Users\\EDZ\\Desktop\\新建文件夹 (2)"
filelist = os.listdir(path)
num = -1
......@@ -28,6 +30,15 @@ fps=pygame.time.Clock()
b=0
fps.tick(60)
while True:
mu=pygame.mixer.Sound(path+'\\'+music_list[num])
ta=int(mu.get_length())
ta_m=ta//60
ta_s=ta%60
if ta_s<10:
ta_s='0'+str(ta_s)
if ta_m<10:
ta_m='0'+str(ta_m)
tas='/'+str(ta_m)+':'+str(ta_s)
time=pygame.mixer.music.get_pos()/1000
time_m=int(time//60)
time_s=int(time%60)
......@@ -105,8 +116,10 @@ while True:
screen.blit(n, (nr[0], nr[1])) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
ts=fo.render(tms,True,(255,255,255))
ts=fo.render(tms,True,(0,0,0))
tss=fo.render(tas,True,(255,255,255))
print(tms)
screen.blit(ts,(120,440))
screen.blit(tss,(190,440))
# 刷新画面
pygame.display.update()
\ No newline at end of file
This diff is collapsed. Click to expand it.
  • Write
  • Preview
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