Commit 2609f380 by BellCodeEditor

save project

parent cf5e256c
Showing with 14 additions and 3 deletions
...@@ -36,10 +36,15 @@ def register(): # 注册验证 ...@@ -36,10 +36,15 @@ def register(): # 注册验证
reg_to_login() reg_to_login()
def login(): # 登录验证 def login(): # 登录验证
global app,alist
name, password = app_login.get_input() name, password = app_login.get_input()
pwd = users.get(name) user_name = users.get(name)
if pwd == password: if user_name != None and user_name["password"] == password:
messagebox.showinfo("成功", "登录成功") alist = users[name]["event"]
app_login.root.destroy()
app = Note()
app.show()
app.root.mainloop()
else: else:
messagebox.showwarning("错误", "用户名或密码错误!") messagebox.showwarning("错误", "用户名或密码错误!")
......
...@@ -37,11 +37,17 @@ class Note(): # 便签、笔记 ...@@ -37,11 +37,17 @@ class Note(): # 便签、笔记
self.ent.delete("0", END) self.ent.delete("0", END)
if info != "": if info != "":
alist.append(info) alist.append(info)
content = json.dumps(users)
with open("user.txt","w",encoding="utf8") as file:
file.write(content)
alist.append(info)
self.canvas.create_text(40,self.y,text=info,font=("宋体",11), self.canvas.create_text(40,self.y,text=info,font=("宋体",11),
anchor=W, fill='#FF9900') anchor=W, fill='#FF9900')
self.y += 30 self.y += 30
app = Note() app = Note()
app.show() app.show()
app.root.mainloop() app.root.mainloop()
......
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