Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_diy4
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
98fddf4a
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0d59b98d
c74990l1384p256a14207/wx842159
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
1.py
my_music.py
1.py
0 → 100644
View file @
98fddf4a
import
pygame
from
pygame
import
locals
pygame
.
init
()
screen
=
pygame
.
display
.
set_mode
((
420
,
540
))
music1
=
pygame
.
mixer
.
Sound
(
"歌曲1.wav"
)
music2
=
pygame
.
mixer
.
Sound
(
"歌曲2.wav"
)
music1
.
play
()
music2
.
play
()
while
True
:
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
exit
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
my_music.py
View file @
98fddf4a
...
@@ -5,7 +5,6 @@ import os
...
@@ -5,7 +5,6 @@ import os
pygame
.
init
()
# 初始化
pygame
.
init
()
# 初始化
# 创建窗口
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
# 载入图片、资源
# 载入图片、资源
bg_img
=
pygame
.
image
.
load
(
'background.png'
)
# 背景图
bg_img
=
pygame
.
image
.
load
(
'background.png'
)
# 背景图
play_img
=
pygame
.
image
.
load
(
'play.png'
)
# 播放按钮
play_img
=
pygame
.
image
.
load
(
'play.png'
)
# 播放按钮
...
@@ -26,7 +25,7 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
...
@@ -26,7 +25,7 @@ pygame.mixer.music.set_volume(volume) # 初始播放音量
click
=
0
click
=
0
play_button
=
stop_img
play_button
=
stop_img
angle
=
0
angle
=
0
music
.
play
while
True
:
while
True
:
for
event
in
pygame
.
event
.
get
():
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
if
event
.
type
==
locals
.
QUIT
:
...
@@ -91,6 +90,7 @@ while True:
...
@@ -91,6 +90,7 @@ while True:
play_m
=
play_time
//
60
play_m
=
play_time
//
60
play_s
=
play_time
%
60
play_s
=
play_time
%
60
if
p
info
=
str
(
play_m
)
+
":"
+
str
(
play_s
)
info
=
str
(
play_m
)
+
":"
+
str
(
play_s
)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
...
...
This diff is collapsed.
Click to expand it.
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