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

Administrator / pygame_lesson6_diy3

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

save project

parent 89bd5f4e
Show whitespace changes
Inline Side-by-side
Showing with 20 additions and 1 deletions
  • my_music.py
my_music.py
View file @ ed5a1591
......@@ -27,6 +27,8 @@ play_button = stop_img
angle=1
FPS=pygame.time.Clock()
font=pygame.font.Font("neuropol.ttf",18)
music_length=0
while True:
for event in pygame.event.get():
......@@ -68,6 +70,9 @@ while True:
click += 2
else:
click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music_length=music1.get_length()
music_length=int(music_length)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1
......@@ -80,6 +85,9 @@ while True:
click += 2
else:
click += 1
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
......@@ -87,11 +95,20 @@ 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=play_time//1000
play_a=play_time//60
play_b=play_time%60
music_length_a=music_length//60
music_length_b=music_length%60
play_c=str(play_a)+":"+str(play_b)
music_length_c="/"+str(music_length_a)+":"+str(music_length_b)
wcc=font.render(music_length_c,True,(0,0,0))
wee=font.render(play_c,True,(0,0,0))
new_logo=pygame.transform.rotate(logo_img,angle)
newRect=new_logo.get_rect(center=(320,200))
......@@ -105,6 +122,7 @@ while True:
screen.blit(new_logo, pos) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(wee,(360,20))
screen.blit(wee,(120,440))
screen.blit(wcc,(170,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