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
76b8759a
authored
Jan 26, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
1fbacccc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
my_music.py
my_music.py
View file @
76b8759a
...
...
@@ -4,6 +4,8 @@ click=0
pygame
.
init
()
# 初始化
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
pygame
.
mixer
.
music
.
load
(
"test.wav"
)
#载入音乐文件
# 载入图片、资源
bg_img
=
pygame
.
image
.
load
(
'background.png'
)
# 背景图
play_img
=
pygame
.
image
.
load
(
'play.png'
)
# 播放按钮
...
...
@@ -15,9 +17,11 @@ pygame.mixer.music.load("歌曲1.wav")
volume
=
0.1
pygame
.
mixer
.
music
.
set_volume
(
volume
)
while
True
:
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
pygame
.
mixer
.
music
.
play
()
#播放
for
event
in
pygame
.
event
.
get
():
??
#点击关闭按钮,程序结束
if
event
.
type
==
locals
.
QUIT
:
#点击关闭按钮,程序结束
exit
()
# 绘制画面
...
...
@@ -27,4 +31,4 @@ while True:
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
# 刷新画面
??
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