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

Administrator / pygame_lesson6_diy4

  • 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 05650597 authored 2 years ago by BellCodeEditor's avatar BellCodeEditor
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

save project

parent 10cb7d63 c4518l1384p256a14207/wx874046
Hide whitespace changes
Inline Side-by-side
Showing with 6 additions and 3 deletions
  • my_music.py
my_music.py
View file @ 05650597
...@@ -14,12 +14,11 @@ next_img = pygame.image.load('next.png') # 下一曲按钮 ...@@ -14,12 +14,11 @@ next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 下一曲按钮 logo_img = pygame.image.load('logo.png') # 下一曲按钮
my_font=pygame.font.Font("neuropol.ttf",18) my_font=pygame.font.Font("neuropol.ttf",18)
sound_length=0 sound_length=0
sound_render=0
music_list = [] music_list = []
path = "C:\\Users\\Administrator\\Desktop\\test" path = "C:\\Users\\Administrator\\Desktop\\test"
filelist = os.listdir(path) filelist = os.listdir(path)
num = -1 num = -1
fpsclock=0 fpsclock=pygame.time.Clock()
for i in filelist: for i in filelist:
if i[-4:] == ".wav" or i[-4:] == ".ogg": if i[-4:] == ".wav" or i[-4:] == ".ogg":
music_list.append(i) music_list.append(i)
...@@ -90,6 +89,9 @@ while True: ...@@ -90,6 +89,9 @@ while True:
num = 0 num = 0
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
sound1=pygame.mixer.Sound(path+"\\"+music_list[num])
sound_length=sound1.get_length()
sound_length=int(sound_length)
new_logo = pygame.transform.rotate(logo_img, angle) new_logo = pygame.transform.rotate(logo_img, angle)
new_logo=pygame.transform.rotate(logo_img,angle) new_logo=pygame.transform.rotate(logo_img,angle)
new_rect=new_logo.get_rect(center=(320,200)) new_rect=new_logo.get_rect(center=(320,200))
...@@ -107,9 +109,10 @@ while True: ...@@ -107,9 +109,10 @@ while True:
if sound_s<10: if sound_s<10:
sound_s="0"+str(sound_s) sound_s="0"+str(sound_s)
new_render=str(music_m)+":"+str(music_s) new_render=str(music_m)+":"+str(music_s)
sound_render=str(music_m)+":"+str(music_s)
text=my_font.render(new_render,True,(255,255,255)) text=my_font.render(new_render,True,(255,255,255))
text2=my_font.render(sound_render,True,(255,0,0)) text2=my_font.render(sound_render,True,(255,0,0))
screen.blit(bg_img, (0, 0)) screen.blit(bg_img, (0, 0))
screen.blit(play_button, (270, 330)) screen.blit(play_button, (270, 330))
screen.blit(new_logo,pos) screen.blit(new_logo,pos)
......
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