Commit b4566a27 by BellCodeEditor

auto save

parent bb7d75df
Showing with 22 additions and 15 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 ...@@ -2,8 +2,7 @@ import tkinter
from tkinter import * from tkinter import *
from tkinter import messagebox from tkinter import messagebox
import json import json
alist = ["星期六下午打篮球", "星期天下午和小美一起看电影",
"12月18日给蒂法过生日", "12.24送妈妈圣诞礼物"]
class Note(): # 便签、笔记 class Note(): # 便签、笔记
def __init__(self): def __init__(self):
...@@ -48,6 +47,9 @@ class Note(): # 便签、笔记 ...@@ -48,6 +47,9 @@ class Note(): # 便签、笔记
self.ent.delete("0", END) self.ent.delete("0", END)
if info != "": if info != "":
alist.append(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), self.canvas.create_text(40,self.y,text=info,font=("宋体",11),
anchor=W, fill='#FF9900') anchor=W, fill='#FF9900')
self.select = tkinter.Radiobutton(self.canvas,image=self.box, self.select = tkinter.Radiobutton(self.canvas,image=self.box,
...@@ -55,11 +57,6 @@ class Note(): # 便签、笔记 ...@@ -55,11 +57,6 @@ class Note(): # 便签、笔记
self.select.place(x=-20,y=self.y-10) self.select.place(x=-20,y=self.y-10)
self.val += 1 self.val += 1
self.y += 30 self.y += 30
with open("user.txt", "r", encoding="utf-8") as f: with open("user.txt", "r", encoding="utf-8") as f:
info = f.read() info = f.read()
users = json.loads(info) users = json.loads(info)
...@@ -87,20 +84,21 @@ def register(): # 注册验证 ...@@ -87,20 +84,21 @@ def register(): # 注册验证
else: else:
user_info = {} user_info = {}
user_info['password'] = password1 user_info['password'] = password1
users[name] = user_info
user_info['event'] = ['提示1:啊是大开始打卡还是快点回家哈','提示2:库萨克的好看哈哈点卡'] user_info['event'] = ['提示1:啊是大开始打卡还是快点回家哈','提示2:库萨克的好看哈哈点卡']
users[name] = user_info
content = json.dumps(users) 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) file.write(content)
# 注册成功,跳往登陆界面 # 注册成功,跳往登陆界面
messagebox.showinfo("成功", "注册成功") messagebox.showinfo("成功", "注册成功")
reg_to_login() reg_to_login()
def login(): # 登录验证 def login(): # 登录验证
global app global app,alist
name, password = app_login.get_input() name, password = app_login.get_input()
pwd = users.get(name) user_name = users.get(name)
if pwd == password: if user_name != None and user_name['password'] == password:
alist = users[name]['event']
app_login.root.destroy() app_login.root.destroy()
app = Note() app = Note()
app.show() app.show()
...@@ -155,7 +153,7 @@ class My_register(): # 注册窗口 ...@@ -155,7 +153,7 @@ class My_register(): # 注册窗口
self.root.title("注册窗口") self.root.title("注册窗口")
self.root.geometry('400x320+500+300') self.root.geometry('400x320+500+300')
self.root.resizable(width=False, height=False) # True可以拉伸,False不能拉伸 self.root.resizable(width=False, height=False) # True可以拉伸,False不能拉伸
def show(self): # 注册界面的所有控件 def show(self): # 注册界面的所有控件
# 用户名、密码、确认密码输入框 # 用户名、密码、确认密码输入框
self.e1 = tkinter.Entry(self.root, show=None, font=('宋体', 14), self.e1 = tkinter.Entry(self.root, show=None, font=('宋体', 14),
......
{"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"]}} {"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 \ 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