Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-5-2
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
d2bc9ced
authored
Mar 04, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
391de7b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
47 deletions
uvijbo.py
uvijbo.py
View file @
d2bc9ced
import
random
,
pygame
PANEL_width
=
1000
PANEL_highly
=
1000
FONT_PX
=
15
pygame
.
init
()
# 创建一个窗口
winSur
=
pygame
.
display
.
set_mode
((
PANEL_width
,
PANEL_highly
))
font
=
pygame
.
font
.
SysFont
(
'123.ttf'
,
22
)
bg_suface
=
pygame
.
Surface
((
PANEL_width
,
PANEL_highly
),
flags
=
pygame
.
SRCALPHA
)
pygame
.
Surface
.
convert
(
bg_suface
)
bg_suface
.
fill
(
pygame
.
Color
(
0
,
0
,
0
,
28
))
winSur
.
fill
((
0
,
0
,
0
))
'''
python知识交流群:695185429
'''
# 改变 '' 内的数字或者字母就行了
letter
=
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'p'
,
'a'
,
's'
,
'd'
,
'f'
,
'g'
,
'h'
,
'j'
,
'k'
,
'l'
,
'z'
,
'x'
,
'c'
,
'v'
,
'b'
,
'n'
,
'm'
]
texts
=
[
font
.
render
(
str
(
letter
[
i
]),
True
,
(
0
,
255
,
0
))
for
i
in
range
(
26
)
]
# 按窗口的宽度来计算可以在画板上放几列坐标并生成一个列表
column
=
int
(
PANEL_width
/
FONT_PX
)
drops
=
[
0
for
i
in
range
(
column
)]
while
True
:
# 从队列中获取事件
for
event
in
pygame
.
event
.
get
():
if
event
.
type
==
pygame
.
QUIT
:
exit
()
elif
event
.
type
==
pygame
.
KEYDOWN
:
chang
=
pygame
.
key
.
get_pressed
()
if
(
chang
[
32
]):
exit
()
# 暂停给定的毫秒数
pygame
.
time
.
delay
(
30
)
# 重新编辑图像
winSur
.
blit
(
bg_suface
,
(
0
,
0
))
for
i
in
range
(
len
(
drops
)):
text
=
random
.
choice
(
texts
)
# 重新编辑每个坐标点的图像
winSur
.
blit
(
text
,
(
i
*
FONT_PX
,
drops
[
i
]
*
FONT_PX
))
drops
[
i
]
+=
1
if
drops
[
i
]
*
10
>
PANEL_highly
or
random
.
random
()
>
0.95
:
drops
[
i
]
=
0
pygame
.
display
.
flip
()
\ No newline at end of file
print
(
'
\n
'
.
join
([
''
.
join
([(
'IloveU'
[(
x
-
y
)
%
len
(
'IloveU'
)]
if
((
x
*
0.05
)
**
2
+
(
y
*
0.1
)
**
2
-
1
)
**
3
-
(
x
*
0.05
)
**
2
*
(
y
*
0.1
)
**
3
<=
0
else
' '
)
for
x
in
range
(
-
30
,
30
)])
for
y
in
range
(
15
,
-
15
,
-
1
)]))
\ 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