Commit 2596f25d by BellCodeEditor

save project

parent 1761dbc4
Showing with 16 additions and 8 deletions
import tkinter
import tkinter
from tkinter import *
from tkinter import messagebox
import json
alist = ["星期六下午打篮球", "星期天下午和小美一起看电影",
"12月18日给蒂法过生日", "12.24送妈妈圣诞礼物"]
class Note(): # 便签、笔记
def __init__(self):
self.root = tkinter.Tk()
......@@ -46,14 +43,23 @@ 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')
# 单选框组件
......@@ -63,7 +69,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)
......@@ -102,10 +108,12 @@ def register(): # 注册验证
reg_to_login()
def login(): # 登录验证
global app
global app,alist
name, password = app_login.get_input()
# 验证用户名、密码是否正确
user_name = users.get(name)
if user_name != None and user_name["password"]==password:
if user_name != None and user_name["password"] == password:
alist = users[name]["event"]
app_login.root.destroy()
app = Note()
app.show()
......
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