Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson4_diy3
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
467d111c
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
8ae608f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
7 deletions
my_music.py
my_music.py
View file @
467d111c
...
...
@@ -3,7 +3,6 @@ import os
import
pygame
from
pygame
import
locals
pygame
.
init
()
# 初始化
# 创建窗口
screen
=
pygame
.
display
.
set_mode
((
640
,
480
))
...
...
@@ -14,7 +13,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'
)
# 中间logo
t
=
[]
p
=
[]
path
=
"C:
\\
Users
\\
makcoo
\\
Desktop
\\
y"
filelist
=
os
.
listdir
(
path
)
for
i
in
filelist
:
...
...
@@ -53,18 +52,18 @@ while True:
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
num
-=
1
if
num
<
0
:
num
=
len
(
path
+
'
\\
'
music_list
)
-
1
num
=
len
(
music_list
)
-
1
click
=
0
play_img
=
stop_img
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
music_list
)
pygame
.
mixer
.
music
.
load
(
music_list
)
pygame
.
mixer
.
music
.
play
()
if
x
>
120
and
x
<
220
and
y
>
350
and
y
<
400
:
num
+=
1
if
num
<
0
:
num
=
len
(
path
+
'
\\
'
music_list
)
+
1
num
=
len
(
music_list
)
+
1
click
=
0
play_img
=
stop_img
pygame
.
mixer
.
music
.
load
(
path
+
'
\\
'
music_list
)
pygame
.
mixer
.
music
.
load
(
music_list
)
pygame
.
mixer
.
music
.
play
()
...
...
@@ -74,7 +73,7 @@ while True:
if
event
.
type
==
locals
.
KEYDOWN
:
if
event
.
key
==
locals
.
K_UP
:
sw
+=
0.1
if
sw
>
1
:
if
sw
>
1
:
sw
=
1
pygame
.
mixer
.
music
.
set_volume
(
sw
)
if
event
.
key
==
locals
.
K_DOWN
:
...
...
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