Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_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
a74b6b0c
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
88ff062b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
my_music.py
my_music.py
View file @
a74b6b0c
...
...
@@ -12,10 +12,10 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲按钮
we
=
pygame
.
font
.
Font
(
neuropol
.
ttf
:
)
we
=
pygame
.
font
.
Font
(
'neuropol.ttf'
,
18
)
qaz
=
pygame
.
time
.
Clock
()
music_list
=
[]
path
=
"C:
\\
Users
\\
Administrator
\\
Desktop
\\
etr
"
path
=
"C:
\\
Users
\\
Administrator
\\
Desktop
\\
gh
"
filelist
=
os
.
listdir
(
path
)
num
=
-
1
for
i
in
filelist
:
...
...
@@ -26,6 +26,8 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click
=
0
play_button
=
stop_img
et
=
0
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
...
...
@@ -54,6 +56,7 @@ while True:
else
:
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
400
:
# 下一曲
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
...
...
@@ -65,7 +68,9 @@ while True:
click
+=
2
else
:
click
+=
1
music0
=
pygame
.
mixer
.
Sound
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music0
.
get_length
()
music_length
=
int
(
music_length
)
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
# 上一曲
num
-=
1
if
num
<
0
:
...
...
@@ -77,6 +82,9 @@ while True:
click
+=
2
else
:
click
+=
1
music0
=
pygame
.
mixer
.
Sound
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music0
.
get_length
()
music_length
=
int
(
music_length
)
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
play_time
=
int
(
play_time
/
1000
)
play_m
=
play_time
//
60
...
...
@@ -89,6 +97,9 @@ while True:
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
music0
=
pygame
.
mixer
.
Sound
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music0
.
get_length
()
music_length
=
int
(
music_length
)
e
=
pygame
.
transform
.
rotate
(
logo_img
,
et
)
l
=
e
.
get_rect
(
center
=
(
320
,
200
))
if
play_button
==
stop_img
:
...
...
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