Commit 731dfdb6 by BellCodeEditor

save project

parent 3d2bc658
Showing with 12 additions and 4 deletions
...@@ -16,6 +16,7 @@ class Note(): # 便签、笔记 ...@@ -16,6 +16,7 @@ class Note(): # 便签、笔记
def remove(self): def remove(self):
mum = self.v.get() mum = self.v.get()
alist.pop(mum) alist.pop(mum)
self.canvas.destroy()
self.show() self.show()
def show(self): # 布置窗口界面 def show(self): # 布置窗口界面
...@@ -29,20 +30,20 @@ class Note(): # 便签、笔记 ...@@ -29,20 +30,20 @@ class Note(): # 便签、笔记
self.ent.place(x=10, y=310) self.ent.place(x=10, y=310)
# 按钮 # 按钮
self.but = tkinter.Button(self.root,text='添加',font=('宋体', 12), self.but = tkinter.Button(self.root,text='添加',font=('宋体', 12),
bg="lightblue", width=25, command=self.get_info) bg="lightblue", width=5, command=self.get_info)
self.but.place(x=240, y=305) self.but.place(x=240, y=305)
# 展示所有的文字 # 展示所有的文字
self.v = tkinter.IntVar() self.v = tkinter.IntVar()
self.y = 20 self.y = 20
val = 0 self.val = 0
for info in alist: for info in alist:
self.canvas.create_text(40, self.y, text=info, self.canvas.create_text(40, self.y, text=info,
font=("宋体", 11), anchor=W, fill='#FF9900') font=("宋体", 11), anchor=W, fill='#FF9900')
self.rb = tkinter.Radiobutton(self.canvas,image =self.box,value=val, self.rb = tkinter.Radiobutton(self.canvas,image =self.box,value=self.val,
variable=self.v,command = self.remove) variable=self.v,command = self.remove)
self.rb.place(x=-30,y=self.y-15) self.rb.place(x=-30,y=self.y-15)
self.y += 30 self.y += 30
val += 1 self.val += 1
def get_info(self): def get_info(self):
info = self.ent.get() info = self.ent.get()
...@@ -51,7 +52,14 @@ class Note(): # 便签、笔记 ...@@ -51,7 +52,14 @@ class Note(): # 便签、笔记
alist.append(info) alist.append(info)
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.rb = tkinter.Radiobutton(self.canvas,image =self.box,value=self.val,
variable=self.v,command = self.remove)
self.rb.place(x=-30,y=self.y-15)
self.y += 30 self.y += 30
val += 1
app = Note() app = Note()
......
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