Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson20-diy3-1
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
a760e31c
authored
Jul 24, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
8ae8c27a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
my_client.py
user.txt
my_client.py
View file @
a760e31c
...
@@ -3,8 +3,6 @@ from tkinter import *
...
@@ -3,8 +3,6 @@ from tkinter import *
from
tkinter
import
messagebox
from
tkinter
import
messagebox
import
json
import
json
alist
=
[
"星期六下午打篮球"
,
"星期天下午和小美一起看电影"
,
"12月18日给蒂法过生日"
,
"12.24送妈妈圣诞礼物"
]
class
Note
():
# 便签、笔记
class
Note
():
# 便签、笔记
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -44,6 +42,9 @@ class Note(): # 便签、笔记
...
@@ -44,6 +42,9 @@ class Note(): # 便签、笔记
def
remod
(
self
):
def
remod
(
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
:
# "w"每次写入都覆盖原来的内容
file
.
write
(
content
)
self
.
canvas
.
destroy
()
self
.
canvas
.
destroy
()
app
.
show
()
app
.
show
()
...
@@ -59,7 +60,7 @@ class Note(): # 便签、笔记
...
@@ -59,7 +60,7 @@ class Note(): # 便签、笔记
self
.
a
=
self
.
a
+
1
self
.
a
=
self
.
a
+
1
self
.
r_1
.
place
(
x
=
-
6
,
y
=
self
.
y
-
13
)
self
.
r_1
.
place
(
x
=
-
6
,
y
=
self
.
y
-
13
)
self
.
y
+=
30
self
.
y
+=
30
with
open
(
"user.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
with
open
(
"user.txt"
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
info
=
f
.
read
()
info
=
f
.
read
()
users
=
json
.
loads
(
info
)
users
=
json
.
loads
(
info
)
...
@@ -85,8 +86,10 @@ def register(): # 注册验证
...
@@ -85,8 +86,10 @@ def register(): # 注册验证
elif
password1
!=
password2
:
elif
password1
!=
password2
:
messagebox
.
showwarning
(
"错误"
,
"两次密码不一致!"
)
messagebox
.
showwarning
(
"错误"
,
"两次密码不一致!"
)
else
:
else
:
users
=
{}
users_into
=
{}
users
[
name
]
=
password1
users_into
[
"password"
]
=
password1
users_into
[
"event"
]
=
[
"zhu,a"
]
users
[
name
]
=
users_into
content
=
json
.
dumps
(
users
)
content
=
json
.
dumps
(
users
)
with
open
(
"user.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
# "w"每次写入都覆盖原来的内容
with
open
(
"user.txt"
,
"w"
,
encoding
=
"utf-8"
)
as
file
:
# "w"每次写入都覆盖原来的内容
file
.
write
(
content
)
file
.
write
(
content
)
...
@@ -95,14 +98,16 @@ def register(): # 注册验证
...
@@ -95,14 +98,16 @@ def register(): # 注册验证
reg_to_login
()
reg_to_login
()
def
login
():
# 登录验证
def
login
():
# 登录验证
global
app
global
app
,
alist
app
=
Note
()
app
.
show
()
app
.
root
.
mainloop
()
name
,
password
=
app_login
.
get_input
()
name
,
password
=
app_login
.
get_input
()
pwd
=
users
.
get
(
name
)
pwd
=
users
.
get
(
name
)
if
pwd
==
password
:
if
pwd
!=
None
and
pwd
[
"password"
]
==
password
:
messagebox
.
showinfo
(
"成功"
,
"登录成功"
)
messagebox
.
showinfo
(
"成功"
,
"登录成功"
)
alist
=
users
[
name
][
"event"
]
app_login
.
root
.
destroy
()
app
=
Note
()
app
.
show
()
app
.
root
.
mainloop
()
else
:
else
:
messagebox
.
showwarning
(
"错误"
,
"用户名或密码错误!"
)
messagebox
.
showwarning
(
"错误"
,
"用户名或密码错误!"
)
...
...
user.txt
View file @
a760e31c
{"admin": "admin", "python": "123456", "111111111111111111": "1", "1": "1"}
{"password": "w", "event": ["zhu,a"], "a": {"password": "a", "event": ["zhu,a"]}, "q": {"password": "1", "event": ["zhu,a"]}, "qa": {"password": "1", "event": ["zhu,a"]}, "e": {"password": "e", "event": ["eeeeee"]}, "d": {"password": "d", "event": ["zhu,a"]}}
\ No newline at end of file
\ 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