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

save project

parent 9c902706 c135489l1384p256a14206/wx290180
Show whitespace changes
Inline Side-by-side
Showing with 23 additions and 2 deletions
  • my_music.py
my_music.py
View file @ cbaaeab8
...@@ -59,6 +59,8 @@ while True: ...@@ -59,6 +59,8 @@ 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()
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music1_length=music1.get_length()
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -71,6 +73,8 @@ while True: ...@@ -71,6 +73,8 @@ while True:
num = len(music_list) - 1 num = len(music_list) - 1
pygame.mixer.music.load(path + "\\" + music_list[num]) pygame.mixer.music.load(path + "\\" + music_list[num])
pygame.mixer.music.play() pygame.mixer.music.play()
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music1_length=music1.get_length()
play_button = stop_img play_button = stop_img
if click % 2 == 0: if click % 2 == 0:
click += 2 click += 2
...@@ -83,6 +87,10 @@ while True: ...@@ -83,6 +87,10 @@ 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()
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
music1_length=music1.get_length()
play_time=pygame.mixer.music.get_pos() play_time=pygame.mixer.music.get_pos()
play_time=int(play_time/1000) play_time=int(play_time/1000)
play_m=play_time//60 play_m=play_time//60
...@@ -90,8 +98,17 @@ while True: ...@@ -90,8 +98,17 @@ while True:
if play_s<10: if play_s<10:
play_s="0"+str(play_s) play_s="0"+str(play_s)
time = str(play_m)+":"+str(play_s) time1 = str(play_m)+":"+str(play_s)
print(time) # print(time1)
music1_length=int(music1_length)
music1_m=music1_length//60
music1_s=music1_length%60
if music1_s<10:
music1_s="0"+str(music1_s)
time2 = str(music1_m)+":"+str(music1_s)
print(time2)
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
...@@ -101,3 +118,7 @@ while True: ...@@ -101,3 +118,7 @@ while True:
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
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