Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson04_diy
This project
Loading...
Sign in
Toggle navigation
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
11f8a971
authored
Dec 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
134de3bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
my_music.py
my_music.py
View file @
11f8a971
...
...
@@ -11,18 +11,16 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 中间logo
pygame
.
mixer
.
music
.
load
(
'HOYO-MiX - Genshin Impact Main Theme 原神.mp3'
)
#载入音乐
pygame
.
mixer
.
music
.
load
(
'HOYO-MiX - Dream Aria (Genshin Impact Main Theme Var.) 梦之咏叹.mp3'
)
pygame
.
mixer
.
music
.
load
(
'HOYO-MiX - 神女劈观·唤情 Devastation and Redemption.mp3'
)
my_font
=
pygame
.
font
.
Font
(
'neuropol.ttf'
,
18
)
music_list
=
[
'HOYO-MiX - Genshin Impact Main Theme 原神.mp3'
,
'HOYO-MiX - Dream Aria (Genshin Impact Main Theme Var.) 梦之咏叹.mp3'
,
'HOYO-MiX - 神女劈观·唤情 Devastation and Redemption.mp3'
]
num
=
0
pygame
.
mixer
.
music
.
load
(
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
play
=
stop_img
#播放/暂停图标状态初始化
volume
=
0
#音量初始化
volume
=
1
#音量初始化
click
=
0.0
#点击次数初始化
pygame
.
mixer
.
music
.
set_volume
(
volume
)
#音量
pygame
.
mixer
.
music
.
play
()
#播放
music_list
=
[
'HOYO-MiX - Genshin Impact Main Theme 原神.mp3'
,
'HOYO-MiX - Dream Aria (Genshin Impact Main Theme Var.) 梦之咏叹.mp3'
,
'HOYO-MiX - 神女劈观·唤情 Devastation and Redemption.mp3'
]
num
=
-
1
while
True
:
for
event
in
pygame
.
event
.
get
():
...
...
@@ -53,6 +51,10 @@ while True:
pygame
.
mixer
.
music
.
unpause
()
play
=
stop_img
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
else
:
play
=
play_img
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment