Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson04_diy
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
6a08c8ac
authored
Oct 20, 2024
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0cb0539d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
my_music.py
my_music.py
View file @
6a08c8ac
...
...
@@ -21,13 +21,13 @@ while True:
if
event
.
type
==
locals
.
QUIT
:
exit
()
if
event
.
type
==
locals
.
KEYDOWN
:
#判断按键是否按下
if
event
.
key
==
locals
.
KEYDOWN
:
#判断按键是否按下
if
event
.
type
==
locals
.
K_UP
:
#判断是否按下上键
a
+=
0.1
#音量增加
if
a
>
1
:
#判断音量是否大于一
a
=
1
#音量设为1
pygame
.
mixer
.
music
.
set_volume
(
a
)
#设置音量大小
if
event
.
type
==
locals
.
K_DOWN
:
#判断是否按下下键
if
event
.
key
==
locals
.
K_DOWN
:
#判断是否按下下键
a
-=
0.1
#音量减小
if
a
<
0
:
#判断音量是否小于0
a
=
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