Commit 3133bc2f by BellCodeEditor

save project

parent d4f0d759
Showing with 19 additions and 7 deletions
......@@ -2,7 +2,7 @@ import tkinter
from tkinter import *
from tkinter import messagebox
import json
alist = ["西江月·夜行黄沙道中","【宋】辛弃疾","明月别枝惊鹊,清风半夜鸣蝉","稻花香里说丰年,听取蛙声一片","七八个星天外,两三点雨山前","旧时茅店社林边,路转溪桥忽见"]
alist = []
class Note(): # 便签、笔记
def __init__(self):
......@@ -12,6 +12,14 @@ class Note(): # 便签、笔记
self.root.resizable(width=False, height=False)
self.bg_img = tkinter.PhotoImage(file="bg.png")
self.box= tkinter.PhotoImage(file="box.png")
def remove(self):
a=self.v.get()
alist.pop(a)
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
file.write(content)
self.canvas.destroy()
app.show()
def show(self): # 布置窗口界面
# 画布
self.canvas = tkinter.Canvas(self.root, width=300, height=340)
......@@ -34,7 +42,7 @@ class Note(): # 便签、笔记
for info in alist:
self.canvas.create_text(40, self.y, text=info,
font=("宋体", 11), anchor=W, fill='#FF9900')
self.rb1=tkinter.Radiobutton(self.canvas,image=self.box,value=self.val,variable=self.v)
self.rb1=tkinter.Radiobutton(self.canvas,image=self.box,value=self.val,variable=self.v,command=self.remove)
self.rb1.place(x=-30,y=self.y-20)
self.val+=1
self.y += 30
......@@ -44,6 +52,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.rb1=tkinter.Radiobutton(self.canvas,image=self.box,value=self.val,variable=self.v)
......@@ -84,8 +95,8 @@ def register(): # 注册验证
else:
user_info={}
user_info["password"]=password1
user_info["event"]={"提示1":"可以从输入框添加新任务",
"提示2":"点击前面选择框表示任务完成"}
user_info["event"]=["提示1:可以从输入框添加新任务",
"提示2:点击前面选择框表示任务完成"]
users[name]=user_info
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
......@@ -95,10 +106,11 @@ def register(): # 注册验证
reg_to_login()
def login():
global app # 登录验证
global app,alist # 登录验证
name, password = app_login.get_input()
pwd = users.get(name)
if pwd['password'] == password:
alist=users[name]["event"]
#messagebox.showinfo("成功", "登录成功")
app_login.root.destroy()
app = Note()
......
{"admin": "admin", "abc": {"password": "abc", "event": {"\u63d0\u793a1": "\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2": "\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\u8868\u793a\u4efb\u52a1\u5b8c\u6210"}}}
\ No newline at end of file
{"\u590f\u7199\u767d": {"password": "2011", "event": ["\u4e0a\u8bfe\u8bfe", "\u9a91\u8f66\u8f66", "\u5582\u72d7\u72d7", "\u905b\u72d7\u72d7", "\u7761\u89c9\u89c9"]}, "\u5200\u5c0f\u4e19": {"password": "12", "event": ["\u897f\u6c5f\u6708\u00b7\u591c\u884c\u9ec4\u6c99\u9053\u4e2d", "\u3010\u5b8b\u3011\u8f9b\u5f03\u75be", "\u660e\u6708\u522b\u679d\u60ca\u9e4a\uff0c\u6e05\u98ce\u534a\u591c\u9e23\u8749", "\u7a3b\u82b1\u9999\u91cc\u8bf4\u4e30\u5e74\uff0c\u542c\u53d6\u86d9\u58f0\u4e00\u7247", "\u4e03\u516b\u4e2a\u661f\u5929\u5916\uff0c\u4e24\u4e09\u70b9\u96e8\u5c71\u524d", "\u65e7\u65f6\u8305\u5e97\u793e\u6797\u8fb9\uff0c\u8def\u8f6c\u6eaa\u6865\u5ffd\u89c1"]}}
\ 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