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
fd059dc3
authored
Mar 05, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
bf3084a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
my_music.py
my_music.py
View file @
fd059dc3
...
@@ -56,10 +56,11 @@ while True:
...
@@ -56,10 +56,11 @@ while True:
click
+=
1
click
+=
1
if
click
%
2
==
0
:
if
click
%
2
==
0
:
play_button
=
stop_img
play_button
=
stop_img
pygame
.
mixer
.
music
.
unpause
()
pygame
.
mixer
.
music
.
unpause
()
else
:
else
:
play_button
=
play_img
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
pygame
.
mixer
.
music
.
pause
()
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
450
:
#暂停
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
450
:
#暂停
pygame
.
mixer
.
music
.
stop
()
pygame
.
mixer
.
music
.
stop
()
play_button
=
stop_img
play_button
=
stop_img
...
@@ -67,6 +68,7 @@ while True:
...
@@ -67,6 +68,7 @@ while True:
click
+=
2
click
+=
2
else
:
else
:
click
+=
1
click
+=
1
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
num
+=
1
...
@@ -74,7 +76,16 @@ while True:
...
@@ -74,7 +76,16 @@ while True:
num
=
0
num
=
0
pygame
.
mixer
.
music
.
load
(
music_list
[
num
])
pygame
.
mixer
.
music
.
load
(
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
play
()
# 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片)
qq
=
pygame
.
mixer
.
Sound
(
music_list
[
num
])
time_1
=
qq
.
get_length
()
time_2
=
int
(
time_1
)
time_3
=
time_2
//
60
time_4
=
time_2
%
60
info2
=
str
(
time_3
)
+
":"
+
str
(
time_4
)
eaxm2
=
play_get
.
render
(
'/'
+
info2
,
True
,(
255
,
255
,
255
))
# 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
#旋转图片,会生成一个新图片,第二个参数是角度,正数就是逆时针,负数就是顺时针
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
#旋转图片,会生成一个新图片,第二个参数是角度,正数就是逆时针,负数就是顺时针
# 校正旋转图片的中心点
# 校正旋转图片的中心点
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
...
@@ -96,7 +107,8 @@ while True:
...
@@ -96,7 +107,8 @@ while True:
screen
.
blit
(
new_logo
,
pos
)
# 中间logo图
screen
.
blit
(
new_logo
,
pos
)
# 中间logo图
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
screen
.
blit
(
eaxm
,(
0
,
0
))
screen
.
blit
(
eaxm
,(
120
,
440
))
screen
.
blit
(
eaxm2
,(
170
,
440
))
# 刷新画面
# 刷新画面
pygame
.
display
.
update
()
pygame
.
display
.
update
()
...
...
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