Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_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
20852428
authored
Sep 01, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
89710a3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
38 deletions
my_music.py
my_music.py
View file @
20852428
...
@@ -82,26 +82,6 @@ while True:
...
@@ -82,26 +82,6 @@ while True:
music_length
=
music1
.
get_length
()
music_length
=
music1
.
get_length
()
music_length
=
int
(
music_length
)
music_length
=
int
(
music_length
)
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
num
+=
1
if
num
>
len
(
music_list
)
-
1
:
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
# 歌曲的时间
music1
=
pygame
.
mixer
.
Sound
(
path
+
"
\\
"
+
music_list
[
num
])
music_length
=
music1
.
get_length
()
music_length
=
int
(
music_length
)
# 歌曲播放进度时间
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
)
# 歌曲的时间长度
# 歌曲的时间长度
music_m
=
music_length
//
60
music_m
=
music_length
//
60
...
@@ -110,24 +90,6 @@ while True:
...
@@ -110,24 +90,6 @@ while True:
music_s
=
"0"
+
str
(
music_s
)
music_s
=
"0"
+
str
(
music_s
)
info2
=
str
(
music_m
)
+
":"
+
str
(
music_s
)
info2
=
str
(
music_m
)
+
":"
+
str
(
music_s
)
# 旋转图片(注意:这里要搞一个新变量,存储旋转后的图片)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
# 校正旋转图片的中心点
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
# print(newRect) # rect(170, 65, 300, 270) 左上角坐标、图片大小
pos
=
(
newRect
[
0
],
newRect
[
1
])
# if判断是否为暂停按钮
if
play_button
==
stop_img
:
angle
+=
1
# 绘制画面
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
new_logo
,
pos
)
# 中间logo图
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
# 绘制时间进度
scoreSurf
=
basic_font
.
render
(
info
,
True
,
(
255
,
255
,
255
))
screen
.
blit
(
scoreSurf
,
(
120
,
440
))
scoreSurf2
=
basic_font
.
render
(
"/"
+
info2
,
True
,
(
0
,
0
,
0
))
scoreSurf2
=
basic_font
.
render
(
"/"
+
info2
,
True
,
(
0
,
0
,
0
))
screen
.
blit
(
scoreSurf2
,
(
170
,
440
))
screen
.
blit
(
scoreSurf2
,
(
170
,
440
))
# 刷新画面
# 刷新画面
...
...
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