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
134de3bf
authored
Dec 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
ef795e26
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
my_music.py
my_music.py
View file @
134de3bf
...
@@ -21,6 +21,8 @@ volume = 0 #音量初始化
...
@@ -21,6 +21,8 @@ volume = 0 #音量初始化
click
=
0.0
#点击次数初始化
click
=
0.0
#点击次数初始化
pygame
.
mixer
.
music
.
set_volume
(
volume
)
#音量
pygame
.
mixer
.
music
.
set_volume
(
volume
)
#音量
pygame
.
mixer
.
music
.
play
()
#播放
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
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
...
@@ -43,16 +45,18 @@ while True:
...
@@ -43,16 +45,18 @@ while True:
#播放/暂停
#播放/暂停
if
event
.
type
==
locals
.
MOUSEBUTTONDOWN
:
if
event
.
type
==
locals
.
MOUSEBUTTONDOWN
:
if
event
.
button
==
1
:
if
event
.
button
==
1
:
click
+=
1
mouse_x
,
mouse_y
=
event
.
pos
print
(
"click"
+
str
(
click
))
if
mouse_x
>
270
and
mouse_x
<
370
and
mouse_y
>
350
and
mouse_y
<
450
:
if
click
%
2
==
0
:
click
+=
1
pygame
.
mixer
.
music
.
unpause
()
print
(
"click"
+
str
(
click
))
play
=
stop_img
if
click
%
2
==
0
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
pygame
.
mixer
.
music
.
unpause
()
pygame
.
mixer
.
music
.
play
()
play
=
stop_img
else
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
play
=
play_img
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
pause
()
else
:
play
=
play_img
pygame
.
mixer
.
music
.
pause
()
# 绘制画面
# 绘制画面
...
...
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