Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson5_diy1
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
0aba8459
authored
Oct 25, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
79c2c7c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
9 deletions
my_music.py
my_music.py
View file @
0aba8459
...
@@ -18,8 +18,8 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
...
@@ -18,8 +18,8 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click
=
0
click
=
0
play_button
=
stop_img
play_button
=
stop_img
false
=
0
false
=
0
musics
=
[]
try
:
try
:
musics
=
[]
filelist
=
os
.
listdir
(
path
)
filelist
=
os
.
listdir
(
path
)
for
i
in
filelist
:
for
i
in
filelist
:
if
i
[
-
4
:]
==
'.wav'
or
i
[
-
4
:]
==
'.ogg'
:
if
i
[
-
4
:]
==
'.wav'
or
i
[
-
4
:]
==
'.ogg'
:
...
@@ -57,18 +57,25 @@ while True:
...
@@ -57,18 +57,25 @@ while True:
else
:
else
:
play_button
=
play_img
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
pygame
.
mixer
.
music
.
pause
()
if
event
.
type
==
locals
.
KEYDOWN
or
evebnt
.
type
==
locals
.
MOUSEBUTTONDOWN
:
if
event
.
key
==
locals
.
K_LEFT
or
x
>
120
and
x
<
220
and
y
>
350
and
y
<
450
:
num
-=
1
if
num
<
0
:
num
=
len
(
musics
)
-
1
if
false
==
1
:
pygame
.
mixer
.
music
.
load
(
musics
[
num
])
else
:
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
+
musics
[
num
])
pygame
.
mixer
.
music
.
play
()
elif
event
.
key
==
locals
.
K_RIGHT
:
num
+=
1
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
num
+=
1
if
event
.
type
==
locals
.
KEYDOWN
:
if
event
.
key
==
locals
.
K_LEFT
:
if
num
>
len
(
musics
)
-
1
:
num
-=
1
elif
event
.
key
==
locals
.
K_RIGHT
:
num
+=
1
if
num
>
len
(
musics
)
-
1
:
num
=
0
num
=
0
if
num
<
0
:
if
num
<
0
:
num
=
4
num
=
len
(
musics
)
-
1
if
false
==
1
:
if
false
==
1
:
pygame
.
mixer
.
music
.
load
(
musics
[
num
])
pygame
.
mixer
.
music
.
load
(
musics
[
num
])
else
:
else
:
...
...
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