Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson18-diy1
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
b94294f2
authored
Dec 07, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
145fe74a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2755 additions
and
5 deletions
my_app.py
my_app.py
View file @
b94294f2
import
tkinter
from
tkinter
import
messagebox
import
json
with
open
(
"user.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
file
:
#打开文件,读出
f
=
file
.
read
()
#读出文件中的内容
user
=
json
.
loads
(
f
)
#转为字典
def
login_to_reg
():
# 登录界面转注册界面
pass
app_login
.
root
.
destroy
()
#销毁
global
app_rep
#全局变量
app_rep
=
My_register
()
#实例化注册窗口
app_rep
.
show
()
#显示
def
reg_to_login
():
# 注册界面转登录界面
pass
app_rep
.
root
.
destroy
()
#销毁注册窗口
app_login
=
My_login
()
#实例化登录窗口
app_login
.
show
()
#展示
def
register
():
# 注册验证
pass
name
,
pw1
,
pw2
=
app_rep
.
get_input
()
#获取注册信息
if
name
==
""
or
pw1
==
""
or
pw2
==
""
:
messagebox
.
showwarning
(
"警告"
,
"注册信息不为空!"
)
#警告
elif
name
in
user
:
#账号已被注册
messagebox
.
showwarning
(
"警告"
,
"账号已被注册!"
)
elif
pw1
!=
pw2
:
#两个密码不一致
messagebox
.
showwarning
(
"警告"
,
"两个密码不一致!"
)
else
:
user
[
name
]
=
pw1
#注册成功
messagebox
.
showinfo
(
"提示"
,
"注册成功!"
)
def
login
():
# 登录验证
pass
...
...
@@ -105,3 +122,2736 @@ class My_register(): # 注册窗口
app_login
=
My_login
()
app_login
.
show
()
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