Commit 8924a5a7 by BellCodeEditor

save project

parent 6d62425d
Showing with 26 additions and 7 deletions
import tkinter import tkinter
form tkinter import messagebox from tkinter import messagebox
import json
with open("user.txt","r",encoding="utf-8") as f:
info=f.read()
users=json.loads(info)
def login_to_reg(): # 登录界面转注册界面 def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy() app_login.root.destroy()
global agg_reg global agg_reg
...@@ -13,12 +17,27 @@ def reg_to_login(): # 注册界面转登录界面 ...@@ -13,12 +17,27 @@ def reg_to_login(): # 注册界面转登录界面
app_login.show() app_login.show()
def register(): # 注册验证 def register(): # 注册验证
name a b =tkinter.Button.get_input() name,a,b =agg_reg.get_input()
if name=="" or a=="" or b=="": if name=="" or a=="" or b=="":
messagebox.showwarning("警告") messagebox.showwarning("警告","填写完整")
elif name in users:
messagebox.showwarning("错误","已有")
elif a != b:
messagebox.showwarning("错误","不一样")
else:
users[name]=a
content=json.dumps(users)
with open("user.txt","w",encoding="utf-8") as file:
file.write(content)
messagebox.showwarning("成功","成功")
reg_to_login()
def login(): # 登录验证 def login(): # 登录验证
pass c,d=app_login.get_input()
e=users.get(c)
if d == e:
messagebox.showwarning("成功","成功")
else:
messagebox.showwarning("错误","错误")
class My_login(): # 登录窗口 class My_login(): # 登录窗口
def __init__(self): def __init__(self):
......
{"admin": "123456"} {"admin": "123456", "a": "a", "b": "1", "1": "1"}
\ No newline at end of file \ 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