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

save project

parent a8337ea0
Show whitespace changes
Inline Side-by-side
Showing with 20 additions and 0 deletions
  • my_music.py
my_music.py
View file @ 813b6654
...@@ -66,6 +66,9 @@ while True: ...@@ -66,6 +66,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
musiclength=music1.get_length()
musiclength=int(musiclength)
if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲 if x > 120 and x < 220 and y > 350 and y < 400: # 上一曲
num -= 1 num -= 1
...@@ -78,6 +81,9 @@ while True: ...@@ -78,6 +81,9 @@ while True:
click += 2 click += 2
else: else:
click += 1 click += 1
music1=pygame.mixer.Sound(path + "\\" + music_list[num])
musiclength=music1.get_length()
musiclength=int(musiclength)
if pygame.mixer.music.get_busy() == False: if pygame.mixer.music.get_busy() == False:
num += 1 num += 1
...@@ -85,6 +91,10 @@ while True: ...@@ -85,6 +91,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])
musiclength=music1.get_length()
musiclength=int(musiclength)
newlogo=pygame.transform.rotate(logo_img,angle) newlogo=pygame.transform.rotate(logo_img,angle)
newRect=newlogo.get_rect(center=(320,200)) newRect=newlogo.get_rect(center=(320,200))
...@@ -99,6 +109,14 @@ while True: ...@@ -99,6 +109,14 @@ while True:
info1=str(playm)+':'+str(plays) info1=str(playm)+':'+str(plays)
text1=a.render(info1,True,(255,255,255)) text1=a.render(info1,True,(255,255,255))
musicm=musiclength//60
musics=musiclength%60
if musics<10:
musics='0'+str(musics)
info2='/'+str(musicm)+':'+str(musics)
text2=a.render(info2,True,(255,255,255))
# 绘制画面 # 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景 screen.blit(bg_img, (0, 0)) # 填充背景
...@@ -107,5 +125,6 @@ while True: ...@@ -107,5 +125,6 @@ while True:
screen.blit(last_img, (120, 350)) # 上一曲 screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲 screen.blit(next_img, (420, 350)) # 下一曲
screen.blit(text1,(120,420)) screen.blit(text1,(120,420))
screen.blit(text2,(170,420))
# 刷新画面 # 刷新画面
pygame.display.update() 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