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
2edc1793
authored
Dec 12, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
763da90b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
my_music.py
my_music.py
View file @
2edc1793
...
...
@@ -24,7 +24,7 @@ volume = 0.2
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# 初始播放音量
click
=
0
play_button
=
stop_img
angle
=
0
angle
=
0
# 设置角度变量
while
True
:
for
event
in
pygame
.
event
.
get
():
...
...
@@ -54,7 +54,7 @@ while True:
else
:
play_button
=
play_img
pygame
.
mixer
.
music
.
pause
()
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
400
:
# 下一曲
if
x
>
420
and
x
<
520
and
y
>
350
and
y
<
400
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
...
...
@@ -66,7 +66,7 @@ while True:
else
:
click
+=
1
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
# 上一曲
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
num
-=
1
if
num
<
0
:
num
=
len
(
music_list
)
-
1
...
...
@@ -85,10 +85,10 @@ while True:
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
pos
=
(
newRect
[
0
],
newRect
[
1
])
if
play_button
==
stop_img
:
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
# 旋转图片
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
# 将图片移到屏幕中间,并返回生成一个元组
pos
=
(
newRect
[
0
],
newRect
[
1
])
# 将元组前两项赋值生成一对坐标
if
play_button
==
stop_img
:
# 当图标为暂停时旋转
angle
+=
1
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
...
...
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