Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_3
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
3c0f9c20
authored
Sep 05, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
76df6f84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
26 deletions
diy1.py
diy1.py
View file @
3c0f9c20
username
=
"python"
# 保存在服务器数据库中的用户账号(正确的账号)
userpassword
=
"123456"
import
turtle
turtle
.
hideturtle
()
turtle
.
goto
(
0
,
0
)
screen
=
turtle
.
Screen
()
screen
.
bgcolor
(
"white"
)
name
=
turtle
.
textinput
(
"登陆验证"
,
"请输入账号昵称:"
)
password
=
turtle
.
textinput
(
"登陆验证"
,
"请输入该账号密码:"
)
if
name
==
username
and
password
==
userpassword
:
turtle
.
write
(
"登陆成功"
,
font
=
(
"Times"
,
15
,
"normal"
))
break
turtle
.
write
(
"登陆失败"
,
font
=
(
"Times"
,
15
,
"normal"
))
name
=
turtle
.
textinput
(
"登陆验证"
,
"请输入账号昵称:"
)
password
=
turtle
.
textinput
(
"登陆验证"
,
"请输入该账号密码:"
)
screen
.
clear
()
if
name
==
username
and
password
==
userpassword
:
turtle
.
write
(
"登陆成功"
,
font
=
(
"Times"
,
15
,
"normal"
))
else
:
turtle
.
write
(
"登陆失败"
,
font
=
(
"Times"
,
15
,
"normal"
))
turtle
.
hideturtle
()
turtle
.
done
()
# 保存在服务器数据库中的用户密码(正确的密码)
s
=
turtle
.
Screen
()
s
.
bgcolor
(
"light blue"
)
# 请用input()实现用户输入账号、密码的功能
pen
=
turtle
.
Pen
()
pen
.
penup
()
pen
.
goto
(
100
,
-
100
)
pen
.
write
(
"12345上山打老虎"
,
font
=
(
"Times"
,
20
,
"normal"
))
pen
.
hideturtle
()
a
=
turtle
.
Pen
()
a
.
pencolor
(
"red"
)
a
.
pensize
(
5
)
m
=
s
.
textinput
(
"提示"
,
"你想要多大的爱心呀?"
)
l
=
int
(
m
)
a
.
left
(
45
)
# 如果用户输入的账号、密码正确,提示登陆成功
\ No newline at end of file
a
.
forward
(
2
*
l
)
a
.
circle
(
l
,
180
)
a
.
right
(
90
)
a
.
circle
(
l
,
180
)
a
.
forward
(
2
*
l
)
a
.
hideturtle
()
turtle
.
done
()
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