Commit 6ce0f439 by BellCodeEditor

save project

parent 6644d08b
Showing with 17 additions and 3 deletions
...@@ -9,8 +9,15 @@ class Note(): # 便签、笔记 ...@@ -9,8 +9,15 @@ class Note(): # 便签、笔记
self.root.geometry('300x340+1000+200') self.root.geometry('300x340+1000+200')
self.root.title("我的便签-待办事项") self.root.title("我的便签-待办事项")
self.root.resizable(width=False, height=False) self.root.resizable(width=False, height=False)
self.img=tkinter.PhotoImage(file="bg.png") #下载图片
def show(self): # 布置窗口界面 def show(self): # 布置窗口界面
self.cav=tkinter.Canvas(self.root,width=300,height=340) #创建画布
self.cav.create_image(0,0,image=self.img,anchor="nw") #给画布上放置图片
self.cav.place(x=0,y=0) #放置画布
self.y=20
for i in alist: #放置文字
self.cav.create_text(40,self.y,text=i,font=("宋体",15),anchor="w",fill="blue")
self.y+=30
# 输入框 # 输入框
self.ent = tkinter.Entry(self.root, show=None, self.ent = tkinter.Entry(self.root, show=None,
font=('宋体', 13), bg="snow", width=25) font=('宋体', 13), bg="snow", width=25)
...@@ -21,8 +28,14 @@ class Note(): # 便签、笔记 ...@@ -21,8 +28,14 @@ class Note(): # 便签、笔记
self.but.place(x=240, y=305) self.but.place(x=240, y=305)
def get_info(self): def get_info(self):
pass self.s=self.ent.get() #获取输入框的内容
s=len(self.s)
self.ent.delete("0",str(s)) #清空输入框
if self.s!="": #不为空才能添加
alist.append(self.s)
self.cav.create_text(40,self.y,text=self.s,font=("宋体",15),anchor="w",fill="blue")
self.y+=30
app = Note() app = Note()
app.show() app.show()
app.root.mainloop() app.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