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
1c9b12a0
authored
2 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
e3015f5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
my_music.py
my_music.py
View file @
1c9b12a0
...
@@ -12,11 +12,11 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
...
@@ -12,11 +12,11 @@ logo_img = pygame.image.load('logo.png') # 下一曲按钮
# 载入音乐
# 载入音乐
music_list
=
[]
music_list
=
[]
path
=
'C:
\\
Users
\\
Administrator
\\
Desktop'
path
=
'C:
\\
Users
\\
Administrator
\\
Desktop
\\
test
'
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"
:
music_list
.
app
a
nd
(
i
)
music_list
.
app
e
nd
(
i
)
volume
=
0.2
volume
=
0.2
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# 初始播放音量
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# 初始播放音量
click
=
0
click
=
0
...
@@ -53,7 +53,7 @@ while True:
...
@@ -53,7 +53,7 @@ while True:
play_button
=
play_img
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
pygame
.
mixer
.
music
.
pause
()
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
4
5
0
:
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
4
0
0
:
num
-=
1
num
-=
1
if
num
<
0
:
if
num
<
0
:
num
=
len
(
music_list
)
-
1
num
=
len
(
music_list
)
-
1
...
@@ -62,10 +62,10 @@ while True:
...
@@ -62,10 +62,10 @@ while True:
click
=
0
click
=
0
play_button
=
stop_img
play_button
=
stop_img
if
x
>
320
and
x
<
42
0
and
y
>
350
and
y
<
400
:
if
x
>
420
and
x
<
54
0
and
y
>
350
and
y
<
400
:
num
+=
1
num
+=
1
if
num
>
3
:
if
num
>
3
:
num
=
len
(
music_list
)
+
1
num
=
len
(
music_list
)
-
4
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
play
()
click
=
3
click
=
3
...
@@ -75,7 +75,7 @@ while True:
...
@@ -75,7 +75,7 @@ while True:
num
+=
1
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
if
num
>
len
(
music_list
)
-
1
:
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
()
# 绘制画面
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
...
...
This diff is collapsed.
Click to expand it.
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