Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson18-diy2
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
73f796ce
authored
Jul 16, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
0b541577
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
diy.py
diy.py
View file @
73f796ce
...
@@ -6,7 +6,6 @@ with open("text.txt","r",encoding="utf-8") as tt:
...
@@ -6,7 +6,6 @@ with open("text.txt","r",encoding="utf-8") as tt:
info
=
tt
.
read
()
info
=
tt
.
read
()
user
=
json
.
loads
(
info
)
user
=
json
.
loads
(
info
)
def
login_to_reg
():
# 登录界面转注册界面
def
login_to_reg
():
# 登录界面转注册界面
app_login
.
root
.
destroy
()
app_login
.
root
.
destroy
()
global
app_reg
global
app_reg
...
@@ -36,9 +35,13 @@ def register(): # 注册验证
...
@@ -36,9 +35,13 @@ def register(): # 注册验证
reg_to_login
()
reg_to_login
()
def
login
():
def
login
():
name
,
passward1
=
app_login
.
get_input
()
name
,
passward1
=
app_reg
.
get_input
()
pwd
=
user
[]
pwd
=
user
.
get
(
name
)
value
=
adict
.
if
pwd
==
passward1
:
messagebox
.
showwarning
(
'提示'
,
'登录成功!'
)
app_reg
.
root
.
destroy
()
else
:
messagebox
.
showwarning
(
'错误'
,
'用户名或密码错误'
)
class
My_login
():
# 登录界面
class
My_login
():
# 登录界面
def
__init__
(
self
):
def
__init__
(
self
):
...
@@ -60,7 +63,7 @@ class My_login(): # 登录界面
...
@@ -60,7 +63,7 @@ class My_login(): # 登录界面
self
.
screen_number
.
place
(
x
=
140
,
y
=
140
)
# 密码窗口的坐标
self
.
screen_number
.
place
(
x
=
140
,
y
=
140
)
# 密码窗口的坐标
button
=
tkinter
.
Button
(
self
.
root
,
text
=
'注册'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightgreen'
,
command
=
login_to_reg
)
# 注册按钮
button
=
tkinter
.
Button
(
self
.
root
,
text
=
'注册'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightgreen'
,
command
=
login_to_reg
)
# 注册按钮
button
.
place
(
x
=
280
,
y
=
200
)
# 按钮位置
button
.
place
(
x
=
280
,
y
=
200
)
# 按钮位置
widge
=
tkinter
.
Button
(
self
.
root
,
text
=
'登录'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightblue'
,
command
=
register
)
# 登录按钮
widge
=
tkinter
.
Button
(
self
.
root
,
text
=
'登录'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightblue'
,
command
=
login
)
# 登录按钮
widge
.
place
(
x
=
140
,
y
=
200
)
# 按钮位置
widge
.
place
(
x
=
140
,
y
=
200
)
# 按钮位置
self
.
root
.
mainloop
()
# 保持运行
self
.
root
.
mainloop
()
# 保持运行
...
@@ -89,7 +92,7 @@ class My_register():
...
@@ -89,7 +92,7 @@ class My_register():
self
.
screen_number
.
place
(
x
=
140
,
y
=
140
)
# 密码窗口的坐标
self
.
screen_number
.
place
(
x
=
140
,
y
=
140
)
# 密码窗口的坐标
self
.
screen_numbers
=
tkinter
.
Entry
(
self
.
root
,
show
=
'*'
,
font
=
(
'宋体'
,
14
),
bg
=
'light grey'
,
width
=
18
)
# 设置确认密码窗口
self
.
screen_numbers
=
tkinter
.
Entry
(
self
.
root
,
show
=
'*'
,
font
=
(
'宋体'
,
14
),
bg
=
'light grey'
,
width
=
18
)
# 设置确认密码窗口
self
.
screen_numbers
.
place
(
x
=
140
,
y
=
200
)
# 确认密码的坐标
self
.
screen_numbers
.
place
(
x
=
140
,
y
=
200
)
# 确认密码的坐标
button
=
tkinter
.
Button
(
self
.
root
,
text
=
'提交'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightblue'
,
command
=
register
)
# 提交按钮
button
=
tkinter
.
Button
(
self
.
root
,
text
=
'提交'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightblue'
,
command
=
login_to_reg
)
# 提交按钮
button
.
place
(
x
=
280
,
y
=
240
)
# 按钮位置
button
.
place
(
x
=
280
,
y
=
240
)
# 按钮位置
widge
=
tkinter
.
Button
(
self
.
root
,
text
=
'取消'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightgreen'
,
command
=
reg_to_login
)
# 取消按钮
widge
=
tkinter
.
Button
(
self
.
root
,
text
=
'取消'
,
font
=
((
'宋体'
),
15
),
bg
=
'lightgreen'
,
command
=
reg_to_login
)
# 取消按钮
widge
.
place
(
x
=
140
,
y
=
240
)
# 按钮位置
widge
.
place
(
x
=
140
,
y
=
240
)
# 按钮位置
...
...
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