Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson5_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
1b98690c
authored
Aug 21, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
bc0f274d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
9 deletions
.py
my_music.py
test.py
neuropol.ttf → ttf.ttf
.py
View file @
1b98690c
import
os
a
=
os
.
listdir
(
r'C:\Users\Administrator\Desktop\新建文件夹'
)
for
i
in
a
:
print
(
i
)
120
220
350
450
pygame
.
transform
.
rotate
320
,
240
320
,
200
\ No newline at end of file
my_music.py
View file @
1b98690c
...
...
@@ -7,6 +7,7 @@ pygame.init() # 初始化
# 创建窗口
ml
=
[]
num
=
-
1
a
=
0
path
=
'C:
\\
Users
\\
Administrator
\\
Desktop
\\
新建文件夹'
mlist
=
listdir
(
path
)
for
i
in
mlist
:
...
...
@@ -20,6 +21,7 @@ stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img
=
pygame
.
image
.
load
(
'last.png'
)
# 上一曲按钮
next_img
=
pygame
.
image
.
load
(
'next.png'
)
# 下一曲按钮
logo_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲按钮
fant
=
pygame
.
font
.
Font
(
'ttf.ttf'
,
14
)
#ml=['歌曲1.wav','歌曲2.wav','歌曲3.wav','歌曲4.ogg']
# 载入音乐
...
...
@@ -30,6 +32,15 @@ click = 0
play_button
=
stop_img
while
True
:
s
=
pygame
.
mixer
.
music
.
get_pos
()
p_s
=
s
//
1000
pm
=
p_s
//
60
ps
=
p_s
%
60
if
ps
<
10
:
ps
=
'0'
+
str
(
ps
)
info
=
str
(
pm
)
+
':'
+
str
(
ps
)
print
(
info
)
score
=
fant
.
render
(
info
,
True
,(
255
,
255
,
255
))
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
locals
.
QUIT
:
exit
()
...
...
@@ -80,13 +91,17 @@ while True:
num
=
0
pygame
.
mixer
.
music
.
load
(
'C:
\\
Users
\\
Administrator
\\
Desktop
\\
新建文件夹'
+
'
\\
'
+
ml
[
num
])
pygame
.
mixer
.
music
.
play
()
if
click
%
2
==
0
:
a
+=
1
# 绘制画面
nlogo
=
pygame
.
transform
.
rotate
(
logo_img
,
90
)
nlogo
=
pygame
.
transform
.
rotate
(
logo_img
,
a
)
r
=
nlogo
.
get_rect
(
center
=
(
320
,
200
))
nr
=
(
r
[
0
],
r
[
1
])
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
play_button
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
nlogo
,
(
170
,
60
)
)
# 中间logo图
screen
.
blit
(
nlogo
,
nr
)
# 中间logo图
screen
.
blit
(
last_img
,
(
120
,
350
))
# 上一曲
screen
.
blit
(
next_img
,
(
420
,
350
))
# 下一曲
screen
.
blit
(
score
,(
120
,
440
))
# 刷新画面
pygame
.
display
.
update
()
test.py
0 → 100644
View file @
1b98690c
import
pygame
b
=
get_rect
(
center
=
(
320
,
220
))
a
=
(
b
[
0
],
b
[
1
])
get_pos
get_length
pygame
.
mixer
.
\ No newline at end of file
neuropol
.ttf
→
ttf
.ttf
View file @
1b98690c
File moved
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