Commit f63c7e82 by BellCodeEditor

save project

parent 8267e846
Showing with 4 additions and 4 deletions
...@@ -2,7 +2,7 @@ import tkinter ...@@ -2,7 +2,7 @@ import tkinter
from tkinter import messagebox from tkinter import messagebox
import json import json
with open("user.txt",encoding="utf-8")as f: with open("C:/Users/Administrator/Documents/level3-lesson18-diy2/user.txt",encoding="utf-8")as f:
info = f.read() info = f.read()
users = json.loads(info) users = json.loads(info)
def login_to_reg(): # 登录界面转注册界面 def login_to_reg(): # 登录界面转注册界面
...@@ -24,7 +24,7 @@ def register(): # 注册验证 ...@@ -24,7 +24,7 @@ def register(): # 注册验证
messagebox.showwarning("错误","用户名已存在!") messagebox.showwarning("错误","用户名已存在!")
elif password1 != password2: elif password1 != password2:
messagebox.showwarning("错误","两次密码不一致!") messagebox.showwarning("错误","两次密码不一致!")
else else:
users[name] = password1 users[name] = password1
content = json.dumps(users) content = json.dumps(users)
with open("user.txt","w",encoding="utf-8") as file: with open("user.txt","w",encoding="utf-8") as file:
......
{"admin": "123456"} {"admin": "123456", "QWERTY": "123456"}
\ 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