Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson5_diy1
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
da64c8ed
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
72f1fef1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
my_music.py
my_music.py
View file @
da64c8ed
...
@@ -11,6 +11,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
...
@@ -11,6 +11,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 中间logo
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 中间logo
font
=
pygame
.
font
.
Font
(
"neuropol.ttf"
,
15
)
volume
=
0.2
volume
=
0.2
pygame
.
mixer
.
music
.
load
(
'test.wav'
)
pygame
.
mixer
.
music
.
load
(
'test.wav'
)
pygame
.
mixer
.
music
.
set_volume
(
volume
)
pygame
.
mixer
.
music
.
set_volume
(
volume
)
...
@@ -80,12 +81,22 @@ while True:
...
@@ -80,12 +81,22 @@ while True:
new_loge
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
new_loge
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
newRect
=
new_loge
.
get_rect
(
center
=
(
320
,
200
))
newRect
=
new_loge
.
get_rect
(
center
=
(
320
,
200
))
pos
=
(
newRect
[
0
],
newRect
[
1
])
pos
=
(
newRect
[
0
],
newRect
[
1
])
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
play_time
=
int
(
play_time
/
1000
)
play_m
=
play_time
//
60
play_s
=
play_time
%
60
if
play_s
<
10
:
play_s
=
'0'
+
str
(
play_s
)
info
=
str
(
play_m
)
+
':'
+
str
(
play_s
)
# 绘制画面
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
new_loge
,
pos
)
# 中间logo图
screen
.
blit
(
new_loge
,
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
))
# 下一曲
play_time
=
font
.
render
(
info
,
True
,(
255
,
255
,
255
))
screen
.
blit
(
play_time
,(
120
,
440
))
# 刷新画面
# 刷新画面
pygame
.
display
.
update
()
pygame
.
display
.
update
()
fps
.
tick
(
60
)
fps
.
tick
(
60
)
\ No newline at end of file
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