Commit d16bf16b by BellCodeEditor

save project

parent 7ed1bfca
Showing with 26 additions and 51 deletions
...@@ -36,15 +36,10 @@ def register(): # 注册验证 ...@@ -36,15 +36,10 @@ def register(): # 注册验证
reg_to_login() reg_to_login()
def login(): # 登录验证 def login(): # 登录验证
global app,alist
name, password = app_login.get_input() name, password = app_login.get_input()
pwd = users.get(name) pwd = users.get(name)
if user_name != None and user_name["password"]==password: if pwd == password:
alist=user[name]["event"] messagebox.showinfo("成功", "登录成功")
app_login.root.destroy()
app=Note()
app.show()
app.root.mainloop()
else: else:
messagebox.showwarning("错误", "用户名或密码错误!") messagebox.showwarning("错误", "用户名或密码错误!")
......
...@@ -36,9 +36,6 @@ class Note(): # 便签、笔记 ...@@ -36,9 +36,6 @@ class Note(): # 便签、笔记
def remove(self): def remove(self):
num=self.v.get() num=self.v.get()
alist.pop(num) alist.pop(num)
content=json.dumps(users)
with open("user.txt","w",encoding="utf-8")as file:
file.write(content)
self.canvas.destroy() self.canvas.destroy()
app.show() app.show()
def get_info(self): def get_info(self):
...@@ -46,12 +43,9 @@ class Note(): # 便签、笔记 ...@@ -46,12 +43,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,value=self.val,variable=self.v,width=25,height=15,borderwidth=0,content=self.remove) self.select=tkinter.Radiobutton(self.canvas,image=self.box,value=self.val,variable=self.v,width=25,height=15,borderwidth=0)
self.select.place(x=-20,y=self.y-10) self.select.place(x=-20,y=self.y-10)
self.va+=1 self.va+=1
self.y += 30 self.y += 30
......
import tkinter import tkinter
root = tkinter.Tk() root = tkinter.Tk()
root.geometry('1000x1000') root.geometry('400x400')
root.title("罗靖翔、陈琸行和邝焯尔的档案") root.title("罗靖翔、陈琸行和邝焯尔的档案")
canvas = tkinter.Canvas(root, width=400, height=400, bg="lightblue") canvas = tkinter.Canvas(root, width=400, height=400, bg="lightblue")
canvas.place(x=0, y=0) canvas.place(x=0, y=0)
...@@ -10,29 +10,32 @@ def func(): ...@@ -10,29 +10,32 @@ def func():
num = v.get() num = v.get()
print("你选择了:",num) print("你选择了:",num)
iable=v,command=func) v = tkinter.IntVar()
rb1 = tkinter.Radiobutton(root,text='罗靖翔出生了',value=1,variable=v,command=func)
rb2 = tkinter.Radiobutton(root,text='罗靖翔的成长',value=2,variable=v,command=func)
rb3 = tkinter.Radiobutton(root,text='罗靖翔结婚了',value=3,variable=v,command=func)
rb4 = tkinter.Radiobutton(root,text='罗靖翔和他老婆生了一个儿子和一个女儿',value=4,variable=v,command=func)
rb5 = tkinter.Radiobutton(root,text='罗靖翔带他全家去环游世界',value=5,variable=v,command=func) rb5 = tkinter.Radiobutton(root,text='罗靖翔带他全家去环游世界',value=5,variable=v,command=func)
rb6 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=6,variable=v,command=func) rb6 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=6,variable=v,command=func)
rb7 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=7,variable=v,command=func) rb7 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=7,variable=v,command=func)
rb8 = tkinter.Radiobutton(root,text='最后在缅北去世',value=8,variable=v,command=func) rb8 = tkinter.Radiobutton(root,text='最后在缅北去世',value=8,variable=v,command=func)
rb9 = tkinter.Radiobutton(root,text='罗靖翔出生了',value=9,variable=v,command=func) rb1 = tkinter.Radiobutton(root,text='罗靖翔出生了',value=1,variable=v,command=func)
rb10 = tkinter.Radiobutton(root,text='陈琸行的成长',value=10,variable=v,command=func) rb2 = tkinter.Radiobutton(root,text='罗靖翔的成长',value=2,variable=v,command=func)
rb11 = tkinter.Radiobutton(root,text='陈琸行结婚了',value=11,variable=v,command=func) rb3 = tkinter.Radiobutton(root,text='罗靖翔结婚了',value=3,variable=v,command=func)
rb12 = tkinter.Radiobutton(root,text='陈琸行和他老婆生了一个儿子和一个女儿',value=12,variable=v,command=func) rb4 = tkinter.Radiobutton(root,text='罗靖翔和他老婆生了一个儿子和一个女儿',value=4,variable=v,command=func)
rb13 = tkinter.Radiobutton(root,text='陈琸行带他全家去环游世界',value=13,variable=v,command=func) rb5 = tkinter.Radiobutton(root,text='罗靖翔带他全家去环游世界',value=5,variable=v,command=func)
rb14 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=14,variable=v,command=func) rb6 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=6,variable=v,command=func)
rb15 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=15,variable=v,command=func) rb7 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=7,variable=v,command=func)
rb16 = tkinter.Radiobutton(root,text='最后在缅北去世',value=16,variable=v,command=func) rb8 = tkinter.Radiobutton(root,text='最后在缅北去世',value=8,variable=v,command=func)
rb17 = tkinter.Radiobutton(root,text='邝焯尔出生了',value=17,variable=v,command=func) rb1 = tkinter.Radiobutton(root,text='罗靖翔出生了',value=1,variable=v,command=func)
rb18 = tkinter.Radiobutton(root,text='邝焯尔的成长',value=18,variable=v,command=func) rb2 = tkinter.Radiobutton(root,text='罗靖翔的成长',value=2,variable=v,command=func)
rb19 = tkinter.Radiobutton(root,text='邝焯尔结婚了',value=19,variable=v,command=func) rb3 = tkinter.Radiobutton(root,text='罗靖翔结婚了',value=3,variable=v,command=func)
rb20 = tkinter.Radiobutton(root,text='邝焯尔和他老婆生了一个儿子和一个女儿',value=20,variable=v,command=func) rb4 = tkinter.Radiobutton(root,text='罗靖翔和他老婆生了一个儿子和一个女儿',value=4,variable=v,command=func)
rb21 = tkinter.Radiobutton(root,text='邝焯尔带他全家去环游世界',value=21,variable=v,command=func) rb5 = tkinter.Radiobutton(root,text='罗靖翔带他全家去环游世界',value=5,variable=v,command=func)
rb22 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=22,variable=v,command=func) rb6 = tkinter.Radiobutton(root,text='他们先去日本喝核废水',value=6,variable=v,command=func)
rb23 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=23,variable=v,command=func) rb7 = tkinter.Radiobutton(root,text='再去缅北嘎腰',value=7,variable=v,command=func)
rb24 = tkinter.Radiobutton(root,text='最后在缅北去世',value=24,variable=v,command=func) rb8 = tkinter.Radiobutton(root,text='最后在缅北去世',value=8,variable=v,command=func)# ++++++++++++++++++++++++++++++++++++++++
# ++++++++++++++++++++++++++++++++++++++++ rb1.place(x=150,y=10)
rb1.place(x=500,y=10)
rb2.place(x=150,y=60) rb2.place(x=150,y=60)
rb3.place(x=150,y=110) rb3.place(x=150,y=110)
rb4.place(x=150,y=160) rb4.place(x=150,y=160)
...@@ -40,20 +43,4 @@ rb5.place(x=150,y=210) ...@@ -40,20 +43,4 @@ rb5.place(x=150,y=210)
rb6.place(x=150,y=260) rb6.place(x=150,y=260)
rb7.place(x=150,y=310) rb7.place(x=150,y=310)
rb8.place(x=150,y=360) rb8.place(x=150,y=360)
rb9.place(x=150,y=10)
rb10.place(x=150,y=60)
rb11.place(x=150,y=110)
rb12.place(x=150,y=160)
rb13.place(x=150,y=210)
rb14.place(x=150,y=260)
rb15.place(x=150,y=310)
rb16.place(x=150,y=360)
rb17.place(x=150,y=10)
rb18.place(x=150,y=60)
rb19.place(x=150,y=110)
rb20.place(x=150,y=160)
rb21.place(x=150,y=210)
rb22.place(x=150,y=260)
rb23.place(x=150,y=310)
rb24.place(x=150,y=360)
root.mainloop() root.mainloop()
\ 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