Commit e63939a3 by BellCodeEditor

save project

parent a7640c06
Showing with 10 additions and 8 deletions
......@@ -2,9 +2,9 @@ import tkinter
import json
from tkinter import messagebox
# with open('user.txt','w",encoding="utf-8") as f:
# info=f.read()
# users=json.loads(info)
with open('user.txt','r',encoding="utf-8") as q:
info=q.read()
users=json.loads(info)
def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy()
......@@ -21,17 +21,17 @@ def reg_to_login(): # 注册界面转登录界面
def register(): # 注册验证
name,password1,password2=app_reg.get_input()
if name=="" or password1=="" or password2=="":
messagebox.showwarning('身份信息未填写完整')
messagebox.showwarning("提示",'身份信息未填写完整')
elif name in users:
messagebox.showwarning('已有此用户名')
messagebox.showwarning("提示",'已有此用户名')
elif password1!=password2:
messagebox.showerror('密码错误')
messagebox.showerror("提示",'密码错误')
else:
users[name]=password1
contont=json.dumps(users)
content=json.dumps(users)
with open('user.txt','w',encoding='utf-8') as file:
file.write(content)
messagebox.showinfo('注册成功')
messagebox.showinfo("提示",'注册成功')
reg_to_login()
def login(): # 登录验证
......
{"12": "1", "122": "12", "21": "22"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment