Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson18-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
f6c34a3f
authored
Jun 10, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
f527f750
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
my_app.py
my_app.py
View file @
f6c34a3f
import
tkinter
from
tkinter
import
messagebox
import
json
with
open
(
"user.txt"
,
"w"
,
encoding
==
"utf-8"
)
as
f
:
info
=
f
.
read
()
users
=
json
.
loads
(
info
)
def
login_to_reg
():
app_login
.
root
.
destroy
()
...
...
@@ -20,17 +25,20 @@ def register(): # 注册验证
messagebox
.
showwarning
(
"错误"
,
"用户已存在"
)
elif
password1
!=
password2
:
messagebox
.
showwarning
(
"错误"
,
"密码填写错误"
)
else
:
else
:
users
[
name
]
=
password1
content
=
json
dumps
(
users
)
with
open
(
"user.txt"
,
"w"
,
encoding
==
"utf-8"
)
as
file
:
fire
.
write
(
content
)
messagebox
.
showinfo
(
"成功"
,
"注册成功"
)
login_show
()
def
login
():
# 登录验证
pass
def
login
():
name
,
password
=
app_reg
.
get_input
()
pwd
=
users
.
get
(
name
)
if
pwd
==
password
:
messagebox
.
showinfo
(
"成功"
,
"登录成功"
)
else
:
messagebox
.
showwarning
(
"错误"
,
"用户名或密码错误"
)
class
My_login
():
# 登录窗口
def
__init__
(
self
):
...
...
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