Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_diy4
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
6603cb30
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
b0de554a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
my_music.py
my_music.py
View file @
6603cb30
...
@@ -13,9 +13,9 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
...
@@ -13,9 +13,9 @@ 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'
)
# 下一曲按钮
kd
=
pygame
.
font
.
Font
(
'neuropl.ttf'
,
14
)
#字体
kd
=
pygame
.
font
.
Font
(
'neurop
o
l.ttf'
,
14
)
#字体
path
=
"C:
\\
Users
\\
xingxing
\\
Desktop
\\
py
"
path
=
"C:
\\
Users
\\
玛酷
\\
Desktop
\\
text
"
filelist
=
os
.
listdir
(
path
)
filelist
=
os
.
listdir
(
path
)
music_list
=
[]
music_list
=
[]
for
i
in
filelist
:
for
i
in
filelist
:
...
@@ -85,7 +85,7 @@ while True:
...
@@ -85,7 +85,7 @@ while True:
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
#播放音乐·
pygame
.
mixer
.
music
.
play
()
#播放音乐·
#歌曲时间
#歌曲时间
music1
=
pygame
.
mixer
.
s
ound
(
path
+
"
\\
"
+
music_list
[
num
])
music1
=
pygame
.
mixer
.
S
ound
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music1
.
get_length
()
music_length
=
music1
.
get_length
()
music_length
=
int
(
music_length
)
music_length
=
int
(
music_length
)
#进度时间
#进度时间
...
@@ -96,7 +96,7 @@ while True:
...
@@ -96,7 +96,7 @@ while True:
play_m
=
play_time
//
60
#分
play_m
=
play_time
//
60
#分
play_s
=
play_time
%
60
#秒
play_s
=
play_time
%
60
#秒
if
play_s
=
<
10
:
if
play_s
<
10
:
play_s
=
"0"
+
str
(
play_s
)
play_s
=
"0"
+
str
(
play_s
)
info
=
str
(
play_m
)
+
":"
+
str
(
play_s
)
info
=
str
(
play_m
)
+
":"
+
str
(
play_s
)
# +++++++++++++++++++++++++++++++++++++
# +++++++++++++++++++++++++++++++++++++
...
@@ -116,5 +116,9 @@ while True:
...
@@ -116,5 +116,9 @@ while True:
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
scoreSurf
=
basic_font
.
render
(
info
,
True
,(
255
,
255
,
255
))
screen
.
blit
(
scoreSurf
,(
120
,
140
))
scoreSurf2
=
basic_font
.
render
(
"/"
+
info2
,(
0
,
0
,
0
))
screen
.
blit
(
scoreSurf2
,(
170
,
440
))
# 刷新画面
# 刷新画面
pygame
.
display
.
update
()
pygame
.
display
.
update
()
\ No newline at end of file
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