Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson6_diy2
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
1e443bf0
authored
a year ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
272dec02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
my_music.py
my_music.py
View file @
1e443bf0
...
@@ -6,14 +6,14 @@ import random
...
@@ -6,14 +6,14 @@ import random
pygame
.
init
()
pygame
.
init
()
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
#FPSLOCK=pygame.time.Clock()
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'
)
# 播放按钮
stop_img
=
pygame
.
image
.
load
(
'stop.png'
)
# 暂停按钮
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_img
=
pygame
.
image
.
load
(
'logo.png'
)
# 下一曲按钮
basic_font
=
pygame
.
font
.
Font
(
'neuropol.ttf'
,
14
)
music_list
=
[]
music_list
=
[]
path
=
"C:
\\
Users
\\
Administrator
\\
Desktop
\\
awa"
path
=
"C:
\\
Users
\\
Administrator
\\
Desktop
\\
awa"
filelist
=
os
.
listdir
(
path
)
filelist
=
os
.
listdir
(
path
)
...
@@ -26,6 +26,9 @@ pygame.mixer.music.set_volume(volume)
...
@@ -26,6 +26,9 @@ pygame.mixer.music.set_volume(volume)
click
=
0
click
=
0
play_button
=
stop_img
play_button
=
stop_img
angle
=
0
angle
=
0
lcl
=
0
a
=
0
c
=
0
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
:
...
@@ -83,12 +86,12 @@ while True:
...
@@ -83,12 +86,12 @@ while True:
num
=
0
num
=
0
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
load
(
path
+
"
\\
"
+
music_list
[
num
])
pygame
.
mixer
.
music
.
play
()
pygame
.
mixer
.
music
.
play
()
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
play_time
=
pygame
.
mixer
.
music
.
get_pos
()
play_time
=
int
(
play_time
/
1000
)
play_time
=
int
(
play_time
/
1000
)
pm
=
play_time
//
60
pm
=
play_time
//
60
ps
=
play_time
%
60
ps
=
play_time
%
60
io
=
str
(
pm
)
+
":"
+
str
(
ps
)
i
nf
o
=
str
(
pm
)
+
":"
+
str
(
ps
)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
new_logo
=
pygame
.
transform
.
rotate
(
logo_img
,
angle
)
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
newRect
=
new_logo
.
get_rect
(
center
=
(
320
,
200
))
...
@@ -99,13 +102,15 @@ while True:
...
@@ -99,13 +102,15 @@ while True:
screen
.
blit
(
play_button
,
(
270
,
330
))
screen
.
blit
(
play_button
,
(
270
,
330
))
screen
.
blit
(
new_logo
,
pos
)
screen
.
blit
(
new_logo
,
pos
)
screen
.
blit
(
last_img
,
(
120
,
350
))
screen
.
blit
(
last_img
,
(
120
,
350
))
screen
.
blit
(
next_img
,
(
420
,
350
)
screen
.
blit
(
next_img
,
(
420
,
350
))
b
=
random
.
randint
(
0
,
255
)
n
=
random
.
randint
(
0
,
255
)
lcl
=
random
.
randint
(
0
,
255
)
m
=
random
.
randint
(
0
,
255
)
a
=
random
.
randint
(
0
,
255
)
c
=
random
.
randint
(
0
,
255
)
scoreSurf
=
basic_font
.
render
(
info
,
True
,(
b
,
n
,
m
))
scoreSurf
=
basic_font
.
render
(
info
,
True
,(
lcl
,
a
,
c
))
screen
.
blit
(
scoreSurf
,(
120
,
440
))
screen
.
blit
(
scoreSurf
,(
120
,
440
))
pygame
.
display
.
update
()
pygame
.
display
.
update
()
#FPSLOCK.tick(9)
\ 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