Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson5_diy2
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
b63a9973
authored
Nov 21, 2020
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
8df9148f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
e.py
e.waw
my_music.py
e.py
0 → 100644
View file @
b63a9973
import
os
pant
=
'C:
\\
Users
\\
yang
\\
Music'
fiielist
=
os
.
listdir
(
pant
)
print
(
fiielist
)
\ No newline at end of file
e.waw
deleted
100644 → 0
View file @
8df9148f
my_music.py
View file @
b63a9973
...
@@ -2,7 +2,7 @@ import pygame
...
@@ -2,7 +2,7 @@ import pygame
from
pygame
import
locals
from
pygame
import
locals
pygame
.
init
()
# 初始化
pygame
.
init
()
# 初始化
click
=
0
# 创建窗口
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
# 载入图片、资源
# 载入图片、资源
...
@@ -12,8 +12,10 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
...
@@ -12,8 +12,10 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲
pygame
.
mixer
.
music
.
set_volume
(
"歌曲2"
.
wav
)
#pygame.mixer.music.
("歌曲2".wav)
volum
=
0.2
volum
=
0.2
music_list
=
[]
num
=-
1
pygame
.
mixer
.
music
.
set_volume
(
volum
)
pygame
.
mixer
.
music
.
set_volume
(
volum
)
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
...
@@ -26,12 +28,16 @@ while True:
...
@@ -26,12 +28,16 @@ while True:
volume
=
1
volume
=
1
pygame
.
mixer
.
music
.
set_volume
(
volume
)
pygame
.
mixer
.
music
.
set_volume
(
volume
)
if
event
.
type
==
locals
.
MOUSEBUTTONDOWN
:
if
event
.
type
==
locals
.
MOUSEBUTTONDOWN
:
clik
+=
1
cli
c
k
+=
1
if
click
%
2
==
0
:
if
click
%
2
==
0
:
pygeme
mixer
.
music
.
unpause
()
pygame
.
mixer
.
music
.
unpause
()
else
:
else
:
pygeme
mixer
.
music
.
pause
()
pygame
.
mixer
.
music
.
pause
()
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
music_list
[
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