Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_diy3
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
dbd6008c
authored
Jan 08, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0aaec8ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
my_music.py
my_music.py
View file @
dbd6008c
...
...
@@ -74,8 +74,8 @@ while True:
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
play_button
=
stop_img
if
click
%
2
==
0
:
click
+=
2
if
click
%
2
==
0
:
#如果在播放
click
+=
2
#仍然播放
else
:
click
+=
1
...
...
@@ -92,11 +92,11 @@ while True:
if
play_button
==
stop_img
:
#如果是播放状态
angle
+=
1
#增加度数(转动)
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
play_musictime
=
int
(
play_time
/
1000
)
play_m
=
play_musictime
//
60
play_s
=
play_musictime
%
60
info
=
str
(
play_m
)
+
':'
+
str
(
play_s
)
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
#获取毫秒
play_musictime
=
int
(
play_time
/
1000
)
#化毫秒为秒,化为整数
play_m
=
play_musictime
//
60
#化秒为分
play_s
=
play_musictime
%
60
#化秒为秒
info
=
str
(
play_m
)
+
':'
+
str
(
play_s
)
#内容为字符串分与秒
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
...
...
@@ -104,7 +104,7 @@ while True:
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
scoreSurf
=
neuropol
.
render
(
info
,
True
,(
210
,
249
,
102
))
screen
.
blit
(
scoreSurf
,(
50
,
450
))
scoreSurf
=
neuropol
.
render
(
info
,
True
,(
210
,
249
,
102
))
#设置文本的内容,抗锯齿,颜色
screen
.
blit
(
scoreSurf
,(
50
,
450
))
#渲染
# 刷新画面
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