Commit b4566a27 by BellCodeEditor

auto save

parent bb7d75df
Showing with 21 additions and 14 deletions
import turtle
pen=turtle.Pen()
pen.pencolor('red')
pen.fillcolor('red')
pen.begin_fill()
pen.circle(10)
pen.end_fill()
turtle.done()
\ No newline at end of file
......@@ -2,8 +2,7 @@ import tkinter
from tkinter import *
from tkinter import messagebox
import json
alist = ["星期六下午打篮球", "星期天下午和小美一起看电影",
"12月18日给蒂法过生日", "12.24送妈妈圣诞礼物"]
class Note(): # 便签、笔记
def __init__(self):
......@@ -48,6 +47,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:
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,
......@@ -55,11 +57,6 @@ 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)
......@@ -87,20 +84,21 @@ def register(): # 注册验证
else:
user_info = {}
user_info['password'] = password1
users[name] = user_info
user_info['event'] = ['提示1:啊是大开始打卡还是快点回家哈','提示2:库萨克的好看哈哈点卡']
users[name] = user_info
content = json.dumps(users)
with open("user.txt", "w", encoding="utf-8") as file: # "w"每次写入都覆盖原来的内容
with open('user.txt','w',encoding='utf-8') as file:
file.write(content)
# 注册成功,跳往登陆界面
messagebox.showinfo("成功", "注册成功")
reg_to_login()
def login(): # 登录验证
global app
global app,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", "a": "111111", "ab": {"password": "111111", "event": ["\u63d0\u7931\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "4": {"password": "444444", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "7": {"password": "777777", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}}
\ No newline at end of file
{"admin": "admin", "python": "123456"}, "a": "111111", "ab": {"password": "111111", "event": ["\u63d0\u7931\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "4": {"password": "444444", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "7": {"password": "777777", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "222": {"password": "222", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "2": {"password": "22", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}, "3": {"password": "33", "event": ["\u63d0\u793a1\uff1a\u554a\u662f\u5927\u5f00\u59cb\u6253\u5361\u8fd8\u662f\u5feb\u70b9\u56de\u5bb6\u54c8", "\u63d0\u793a2\uff1a\u5e93\u8428\u514b\u7684\u597d\u770b\u54c8\u54c8\u70b9\u5361"]}}
\ 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