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
f7c34299
authored
Dec 03, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
4c30b839
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletions
my_music.py
test.py
test.wav
my_music.py
View file @
f7c34299
import
pygame
import
pygame
import
os
from
pygame
import
locals
from
pygame
import
locals
pygame
.
init
()
pygame
.
init
()
...
@@ -16,7 +17,18 @@ volume = 0.2
...
@@ -16,7 +17,18 @@ volume = 0.2
pygame
.
mixer
.
music
.
load
(
'歌曲4.ogg'
)
pygame
.
mixer
.
music
.
load
(
'歌曲4.ogg'
)
pygame
.
mixer
.
music
.
set_volume
(
volume
)
pygame
.
mixer
.
music
.
set_volume
(
volume
)
click
=
0
click
=
0
music_list
=
[]
play_button
=
stop_img
play_button
=
stop_img
path
=
'C:
\\
Users
\\
Administrator
\\
Desktop
\\
新建文件夹 (2)'
filelist
=
os
.
listdir
(
path
)
for
file
in
filelist
:
if
file
[
-
4
:]
==
'.wav'
or
file
[
-
4
:]
==
'.ogg'
:
music_list
.
append
(
file
)
num
=-
1
num
=-
1
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
...
@@ -46,7 +58,7 @@ while True:
...
@@ -46,7 +58,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
(
music_list
[
num
])
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
play
()
# 绘制画面
# 绘制画面
...
...
test.py
0 → 100644
View file @
f7c34299
import
os
filelist
=
os
.
listdir
(
'C:
\\
Users
\\
Administrator
\\
Desktop
\\
新建文件夹 (2)'
)
print
(
filelist
)
\ No newline at end of file
test.wav
View file @
f7c34299
No preview for this file type
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