Commit 84917381 by BellCodeEditor

save project

parent c650d91d
Showing with 12 additions and 20 deletions
......@@ -3,6 +3,9 @@ from tkinter import *
from tkinter import messagebox
import json
alist = ["星期六下午打篮球", "星期天下午和小美一起看电影",
"12月18日给蒂法过生日", "12.24送妈妈圣诞礼物"]
class Note(): # 便签、笔记
def __init__(self):
self.root = tkinter.Tk()
......@@ -43,23 +46,14 @@ class Note(): # 便签、笔记
def remove(self): # 清除选中的任务事件
num = self.v.get()
alist.pop(num)
# 更新用户待办事项
content = json.dumps(users)
with open("user.txt", "w", encoding="utf8") as file:
file.write(content)
# 重新渲染便签界面
self.canvas.destroy()
app.show()
def get_info(self): # 获取用户添加的新事件
def get_info(self):
info = self.ent.get()
self.ent.delete("0", END)
if info != "":
alist.append(info)
# 更新用户待办事项
content = json.dumps(users)
with open("user.txt", "w", encoding="utf8") as file:
file.write(content)
self.canvas.create_text(40,self.y,text=info,font=("宋体",11),
anchor=W, fill='#FF9900')
# 单选框组件
......@@ -69,7 +63,7 @@ class Note(): # 便签、笔记
self.select.place(x=-20,y=self.y-10)
self.val += 1
self.y += 30
# 读取用户信息
with open("user.txt", "r", encoding="utf-8") as f:
info = f.read()
users = json.loads(info)
......@@ -108,12 +102,10 @@ def register(): # 注册验证
reg_to_login()
def login(): # 登录验证
global app,alist
global app
name, password = app_login.get_input()
# 验证用户名、密码是否正确
user_name = users.get(name)
if user_name != None and user_name["password"] == password:
alist = users[name]["event"]
pwd = users.get(name)
if pwd == password:
app_login.root.destroy()
app = Note()
app.show()
......@@ -206,8 +198,8 @@ class My_register(): # 注册窗口
self.root.mainloop()
def get_input(self): # 获取提交的注册信息
self.name = self.e1.get()
self.password1 = self.e2.get()
elf.name = self.e1.get()
self.passsword1 = self.e2.get()
self.password2 = self.e3.get()
return self.name, self.password1, self.password2
......
{"1111": {"password": "111", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "111": {"password": "111", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "123": {"password": "123", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "12": {"password": "123", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "123456": {"password": "666666", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "777": {"password": "777", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "qqq": {"password": "qqq", "event": ["\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210", "sdcsdsd"]}, "www": {"password": "www", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210", "sdsds", "sddwe"]}, "nnn": {"password": "nnn", "event": ["1234567", "1111", "111"]}}
\ No newline at end of file
{"1111": {"password": "111", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "111": {"password": "111", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "123": {"password": "123", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "12": {"password": "123", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u8f93\u5165\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}}
\ 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