Commit c67ccc8f by BellCodeEditor

auto save

parent 53b0f1a7
Showing with 9 additions and 12 deletions
import tkinter,json
with open('user.txt','r',encoding='utf-8')as f:
users=json.loads(f.read())
with open('user.txt','r',encoding='utf-8')as f:users=json.loads(f.read())
from tkinter import messagebox
def login_to_reg(): # 登录界面转注册界面
app_login.root.destroy()
......@@ -14,18 +13,16 @@ def reg_to_login(): # 注册界面转登录界面
app_login.show()
def register(): # 注册验证
a,b,c=app_reg.get_input()
if a==''or b==''or c=='':messagebox.showwarning('Warning','The info is not completed!')
if a==''or b==''or c=='':messagebox.showwarning('Warning','The info is not compeleted!')
elif a in users:messagebox.showerror('Error','The username is existed!')
elif b!=c:messagebox.showerror('Error','The passwords is not fited!')
else:
messagebox.showinfo('Successed','The register is completed.')
messagebox
users[a]=b
with open('user.txt','w',encoding='utf-8')as f:f.write(json.dumps(users))
reg_to_login()
def login():
a,b=get_input() # 登录验证
if a in users.get()and users[a]==b:messagebox.showinfo('Successed','The login is completed.')
else:messagebox.showerror('Error','The username or password is not right.')
def login(): # 登录验证
a,b=get_input()
if
class My_login(): # 登录窗口
def __init__(self):
self.root = tkinter.Tk()
......
{'a':'1'}
\ No newline at end of file
{"admin": "123456"}
\ 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