Commit 905b3264 by BellCodeEditor

save project

parent cfba54da
Showing with 17 additions and 6 deletions
......@@ -48,6 +48,9 @@ class Note(): # 便签、笔记
self.ent.delete("0", END)
if info != "":
alist.append(info)
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
file.write(content)
self.canvas.create_text(40,self.y,text=info,font=("宋体",11),
anchor=W, fill='#FF9900')
self.select = tkinter.Radiobutton(self.canvas,image=self.box,value=self.val,variable=self.v,width=25,height=15,
......@@ -58,6 +61,9 @@ class Note(): # 便签、笔记
def remove(self):
num = self.v.get()
alist.pop(num)
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
file.write(content)
self.canvas.destroy()
app.show()
......@@ -86,7 +92,10 @@ def register(): # 注册验证
elif password1 != password2:
messagebox.showwarning("错误", "两次密码不一致!")
else:
users[name] = password1
user_info={}
user_info['password']=password1
user_info['event']=['提示1:可以从输入框中添加未完成任务。','提示2:点每一个任务或提示前面的小框代表完成会自动删除。']
users[name]=user_info
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
file.write(content)
......@@ -95,10 +104,12 @@ def register(): # 注册验证
reg_to_login()
def login():
global app # 登录验证
global app
global alist # 登录验证
name, password = app_login.get_input()
pwd = users.get(name)
if pwd == password:
user_name=users.get(name)
if user_name != None and user_name['password']==password:
alist = users[name]['event']
app_login.root.destroy()
app = Note()
app.show()
......
{"admin": "admin", "python": "123456", "Happy": "5679419"}
\ No newline at end of file
{"Happy": {"password": "5679419", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u4e2d\u6dfb\u52a0\u672a\u5b8c\u6210\u4efb\u52a1\u3002", "\u63d0\u793a2\uff1a\u70b9\u6bcf\u4e00\u4e2a\u4efb\u52a1\u6216\u63d0\u793a\u524d\u9762\u7684\u5c0f\u6846\u4ee3\u8868\u5b8c\u6210\u4f1a\u81ea\u52a8\u5220\u9664\u3002"]}, "Jason": {"password": "5679419", "event": []}}
\ 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