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
d7d47b9e
authored
Jul 19, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
5f5b5c1e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletions
my_music.py
my_music.py
View file @
d7d47b9e
...
...
@@ -12,7 +12,6 @@ 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'
)
# 下一曲按钮
music_list
=
[]
path
=
"C:
\\
Users
\\
Administrator
\\
Desktop"
filelist
=
os
.
listdir
(
path
)
...
...
@@ -80,6 +79,19 @@ while True:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
music1
=
pygame
.
mixer
.
Soud
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music1
.
get_lengt
()
music_length
=
int
(
play_m
)
music_m
=
music_length
//
60
music_s
=
music_length
%
60
if
music_s
<
10
:
music_s
=
"0"
+
str
(
music_s
)
info2
=
str
(
music_m
)
+
":"
+
str
(
music_s
)
#旋转唱片图标
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
jiaodu
)
newRect
=
new_logo
.
get_rect
(
center
=
(
200
,
90
))
...
...
@@ -92,5 +104,8 @@ while True:
screen
.
blit
(
logo_img
,
(
170
,
60
))
# 中间logo图
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
#绘制时间长度
scoreSurf
=
basic_font
.
render
(
info
,
True
)
# 刷新画面
pygame
.
display
.
update
()
\ No newline at end of file
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