Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
pygame_lesson04_diy
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
03c89584
authored
Feb 05, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
6f3561ad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
31 deletions
my_music.py
密码生成器.py
my_music.py
View file @
03c89584
...
@@ -9,41 +9,41 @@ last_img = pygame.image.load('last.png') # 上一曲按钮
...
@@ -9,41 +9,41 @@ 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
#pygame.mixer.music.load('歌曲4.ogg')
#pygame.mixer.music.load('歌曲4.ogg')
volume
=
0.2
pygame
.
mixer
.
music
.
set_volume
(
volume
)
start
=
stop_img
click
=
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
:
exit
()
exit
()
# volume = 0.2
# pygame.mixer.music.set_volume(volume)
for
event
in
pygame
.
event
.
get
():
# start = stop_img
if
event
.
type
==
locals
.
QUIT
:
# click = 0
exit
()
# while True:
if
event
.
type
==
locals
.
KEYDOWN
:
# for event in pygame.event.get():
if
event
.
key
==
locals
.
K_UP
:
# if event.type == locals.QUIT:
volume
+=
0.1
# exit()
if
volume
<
0
or
volume
==
0
:
# if event.type == locals.KEYDOWN:
volume
=
0
# if event.key == locals.K_UP:
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# volume += 0.1
if
event
.
key
==
locals
.
K_DOWN
:
# if volume < 0 or volume==0:
volume
-=
0.1
# volume = 0
if
volume
<
0
or
volume
==
0
:
# pygame.mixer.music.set_volume(volume)
volume
=
0
# if event.key == locals.K_DOWN:
pygame
.
mixer
.
music
.
set_volume
(
volume
)
# volume -= 0.1
if
event
.
type
==
locals
.
MOUSEBUTTONDOWN
:
# if volume < 0 or volume==0:
click
+=
1
# volume = 0
if
click
%
2
==
0
:
# pygame.mixer.music.set_volume(volume)
pygame
.
mixer
.
music
.
unpause
()
# if event.type == locals.MOUSEBUTTONDOWN:
start
=
stop_img
# click += 1
else
:
# if click%2 == 0:
pygame
.
mixer
.
music
.
pause
()
# pygame.mixer.music.unpause()
start
=
play_img
# start = stop_img
if
volume
<=
0
:
# else:
volume
=
0
# pygame.mixer.music.pause()
if
pygame
.
mixer
.
music
.
get_busy
()
==
False
:
# start = play_img
pygame
.
mixer
.
music
.
play
()
# if volume <=0:
# volume = 0
# if pygame.mixer.music.get_busy() == False:
# pygame.mixer.music.play()
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
bg_img
,
(
0
,
0
))
# 填充背景
screen
.
blit
(
stop_img
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
stop_img
,
(
270
,
330
))
# 暂停按钮
screen
.
blit
(
logo_img
,
(
170
,
60
))
# 中间logo图
screen
.
blit
(
logo_img
,
(
170
,
60
))
# 中间logo图
...
...
密码生成器.py
0 → 100644
View file @
03c89584
import
random
import
random
zm
=
[
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,]
while
True
:
mm
=
''
try
:
lx
=
int
(
input
(
'请输入密码形式:(1是纯数字,2是纯字母,3是都有)'
))
if
lx
!=
1
and
lx
!=
2
and
lx
!=
3
:
print
(
'请输入1到3!'
)
continue
cd
=
int
(
input
(
'请输入密码长度:'
))
except
:
print
(
'请输入整数!'
)
else
:
if
lx
==
1
:
for
i
in
range
(
cd
):
s
=
random
.
choice
(
zm
[:
10
])
mm
+=
s
elif
lx
==
2
:
for
i
in
range
(
cd
):
s
=
random
.
choice
(
zm
[
10
:])
mm
+=
s
else
:
for
i
in
range
(
cd
):
s
=
random
.
choice
(
zm
)
mm
+=
s
print
(
'密码是'
+
mm
)
print
(
'='
*
80
)
\ No newline at end of file
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