Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson19-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ea9d458d
authored
Feb 16, 2025
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
29e17e7f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
545331873ec102c9614d77fbfb569488kk.png
client.py
kk.png
545331873ec102c9614d77fbfb569488kk.png
0 → 100644
View file @
ea9d458d
293 KB
client.py
View file @
ea9d458d
#库导入
import
tkinter
from
tkinter
import
*
#初始内容
alist
=
[
"星期六下午打篮球"
,
"星期天下午和小美一起看电影"
,
"12月18日给蒂法过生日"
,
"12.24送妈妈圣诞礼物"
]
class
Note
():
# 便签、笔记
def
__init__
(
self
):
#创建窗口
self
.
root
=
tkinter
.
Tk
()
self
.
root
.
geometry
(
'300x340+500+200'
)
self
.
root
.
title
(
"我的便签-待办事项"
)
self
.
root
.
resizable
(
width
=
False
,
height
=
False
)
#预加载图片
self
.
bg1
=
tkinter
.
PhotoImage
(
file
=
'kk.png'
)
self
.
bg1
=
tkinter
.
PhotoImage
(
file
=
'bg.png'
)
def
show
(
self
):
self
.
canvas
=
tkinter
.
Canvas
(
self
.
root
,
width
=
300
,
height
=
340
)
# 布置窗口界面
def
show
(
self
):
# 布置窗口界面
#绘制背景图片
self
.
canvas
=
tkinter
.
Canvas
(
self
.
root
,
width
=
300
,
height
=
340
)
self
.
canvas
.
create_image
(
0
,
0
,
image
=
self
.
bg1
,
anchor
=
NW
)
self
.
canvas
.
place
(
x
=
0
,
y
=
0
)
# 输入框
...
...
@@ -25,21 +29,30 @@ class Note(): # 便签、笔记
self
.
but
=
tkinter
.
Button
(
self
.
root
,
text
=
'添加'
,
font
=
(
'宋体'
,
12
),
bg
=
"lightblue"
,
width
=
5
,
command
=
self
.
get_info
)
self
.
but
.
place
(
x
=
240
,
y
=
305
)
#遍历alist列表内容
self
.
y
=
20
for
i
in
alist
:
self
.
canvas
.
create_text
(
40
,
self
.
y
,
text
=
i
,
font
=
(
'宋体'
,
10
),
anchor
=
W
,
fill
=
'#881155'
)
#写入内容
self
.
canvas
.
create_text
(
40
,
self
.
y
,
text
=
i
,
font
=
(
'宋体'
,
10
),
anchor
=
W
,
fill
=
'#881155'
)
self
.
y
+=
30
def
get_info
(
self
):
def
get_info
(
self
):
# 按钮功能
#获取输入框内容
self
.
get
=
self
.
ent
.
get
()
#输入框内容判断
if
self
.
get
!=
""
:
#在列表中追加写入内容
alist
.
append
(
self
.
get
)
self
.
canvas
.
create_text
(
40
,
self
.
y
,
text
=
self
.
get
,
font
=
(
'宋体'
,
10
),
anchor
=
W
,
fill
=
'#881155'
)
#写入内容
self
.
canvas
.
create_text
(
40
,
self
.
y
,
text
=
self
.
get
,
font
=
(
'宋体'
,
10
),
anchor
=
W
,
fill
=
'#881155'
)
self
.
y
+=
30
#删除输入框内容
self
.
ent
.
delete
(
'0'
,
END
)
#程序运行
app
=
Note
()
app
.
show
()
#刷新
app
.
root
.
mainloop
()
\ No newline at end of file
kk.png
0 → 100644
View file @
ea9d458d
293 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment