Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson20-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
0ed550ff
authored
Mar 03, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
95d6aca1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
__pycache__/my_client.cpython-37.pyc
code.py
my_client.py
user.txt
__pycache__/my_client.cpython-37.pyc
View file @
0ed550ff
No preview for this file type
code.py
View file @
0ed550ff
...
...
@@ -63,10 +63,11 @@ def login(): # 登录验证
name
,
password
=
app_login
.
get_input
()
# 验证用户名、密码是否正确
user_name
=
users
.
get
(
name
)
print
(
user_name
)
if
user_name
!=
None
and
user_name
[
"password"
]
==
password
:
alist
=
users
[
name
][
"event"
]
app_login
.
root
.
destroy
()
my_client
.
start
()
my_client
.
start
(
name
)
# app = Note()
# app.show()
# app.root.mainloop()
...
...
my_client.py
View file @
0ed550ff
import
tkinter
from
tkinter
import
*
import
json
alist
=
[
"星期六下午打篮球"
,
"星期天下午和小美一起看电影"
,
"12月18日给蒂法过生日"
,
"12.24送妈妈圣诞礼物"
]
#
alist = ["星期六下午打篮球", "星期天下午和小美一起看电影",
#
"12月18日给蒂法过生日", "12.24送妈妈圣诞礼物"]
with
open
(
"user.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
info
=
f
.
read
()
users
=
json
.
loads
(
info
)
...
...
@@ -59,9 +59,14 @@ class Note(): # 便签、笔记
# self.select.place(x=-20,y=self.y-10)
# self.val += 1
# self.y += 30
# myname =
alist
.
append
(
info
)
print
(
"222=="
,
alist
)
# 更新用户待办事项
content
=
json
.
dumps
(
users
)
print
(
"333=="
,
content
)
with
open
(
"user.txt"
,
"w"
,
encoding
=
"utf8"
)
as
file
:
file
.
write
(
content
)
self
.
canvas
.
create_text
(
40
,
self
.
y
,
text
=
info
,
font
=
(
"宋体"
,
11
),
...
...
@@ -78,6 +83,7 @@ class Note(): # 便签、笔记
alist
.
pop
(
num
)
# 更新用户待办事项
content
=
json
.
dumps
(
users
)
print
(
"remove--"
,
content
)
with
open
(
"user.txt"
,
"w"
,
encoding
=
"utf8"
)
as
file
:
file
.
write
(
content
)
# 重新渲染便签界面
...
...
@@ -87,8 +93,10 @@ class Note(): # 便签、笔记
'''
自定义启动
'''
def
start
():
global
app
def
start
(
name
):
print
(
"111=="
,
name
)
global
app
,
alist
alist
=
users
[
name
][
"event"
]
app
=
Note
()
app
.
show
()
app
.
root
.
mainloop
()
...
...
user.txt
View file @
0ed550ff
{"admin": "admin", "python": "123456"}
\ No newline at end of file
{"admin": "admin", "python": "123456", "aaa": {"password": "111", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210"]}, "cc": {"password": "11", "event": ["\u63d0\u793a1\uff1a\u53ef\u4ee5\u4ece\u8f93\u5165\u6846\u6dfb\u52a0\u65b0\u4efb\u52a1", "\u63d0\u793a2\uff1a\u70b9\u51fb\u524d\u9762\u9009\u62e9\u6846\uff0c\u8868\u793a\u4efb\u52a1\u5b8c\u6210", "aa", "bb", "cc"]}}
\ No newline at end of file
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