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
91215375
authored
Oct 17, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b22126d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
my_music.py
my_music.py
View file @
91215375
...
@@ -3,7 +3,7 @@ from pygame import locals
...
@@ -3,7 +3,7 @@ from pygame import locals
import
os
import
os
click
=
False
click
=
False
path
=
"C:
\\
Users
\\
张国耀
\\
Desktop
\\
1
\\
"
pygame
.
init
()
# 初始化
pygame
.
init
()
# 初始化
# 创建窗口
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
...
@@ -18,7 +18,7 @@ mlist=os.listdir(r"C:\Users\张国耀\Desktop\1")
...
@@ -18,7 +18,7 @@ mlist=os.listdir(r"C:\Users\张国耀\Desktop\1")
a
=-
1
a
=-
1
for
file
in
mlist
:
for
file
in
mlist
:
a
+=
1
a
+=
1
if
file
[
-
4
:]
!=
(
".wav"
,
".ogg"
,
".mp3"
)
:
if
file
[
-
4
:]
!=
".wav"
and
file
[
-
4
:]
!=
".ogg"
and
file
[
-
4
:]
!=
".mp3"
:
mlist
.
pop
(
a
)
mlist
.
pop
(
a
)
# 载入音乐
# 载入音乐
num
=-
1
num
=-
1
...
@@ -59,12 +59,21 @@ while True:
...
@@ -59,12 +59,21 @@ while True:
pygame
.
mixer
.
music
.
pause
()
pygame
.
mixer
.
music
.
pause
()
click
=
True
click
=
True
if
x
>
120
and
x
<
220
and
y
<
400
and
y
>
350
:
if
num
>
0
:
num
-=
1
pygame
.
mixer
.
music
.
load
(
path
+
mlist
[
num
])
pygame
.
mixer
.
music
.
play
()
elif
num
==
0
:
num
=
len
(
mlist
)
-
1
pygame
.
mixer
.
music
.
load
(
path
+
mlist
[
num
])
pygame
.
mixer
.
music
.
play
()
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
if
num
>
len
(
mlist
)
-
1
:
if
num
>
len
(
mlist
)
-
1
:
num
=
0
num
=
0
else
:
else
:
num
+=
1
num
+=
1
path
=
"C:
\\
Users
\\
张国耀
\\
Desktop
\\
1
\\
"
pygame
.
mixer
.
music
.
load
(
path
+
mlist
[
num
])
pygame
.
mixer
.
music
.
load
(
path
+
mlist
[
num
])
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
play
()
...
...
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