Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson18-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
bbb5eac0
authored
Aug 13, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
fa6b3a14
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
my_app.py
my_app.py
View file @
bbb5eac0
import
tkinter
import
tkinter
from
tkinter
import
messagebox
as
mess
def
login_to_reg
():
# 登录界面转注册界面
def
login_to_reg
():
# 登录界面转注册界面
app_login
.
root
.
destroy
()
app_login
.
root
.
destroy
()
...
@@ -9,11 +10,19 @@ def login_to_reg(): # 登录界面转注册界面
...
@@ -9,11 +10,19 @@ def login_to_reg(): # 登录界面转注册界面
def
reg_to_login
():
# 注册界面转登录界面
def
reg_to_login
():
# 注册界面转登录界面
app_reg
.
root
.
destroy
()
app_reg
.
root
.
destroy
()
global
app_login
global
app_login
app_login
=
My_
register
()
app_login
=
My_
login
()
app_login
.
show
()
app_login
.
show
()
def
register
():
# 注册验证
def
register
():
# 注册验证
pass
name
,
password1
,
password2
=
app_reg
.
get_input
()
if
password1
!=
''
and
name
!=
''
and
not
' '
in
password1
and
not
' '
in
name
:
if
password1
==
password2
:
mess
.
showinfo
(
'注册成功'
+
'用户名:'
+
name
+
'
\n
'
,
'密码:'
+
password1
)
print
(
'密码:'
+
password1
)
else
:
mess
.
showerror
(
'错误'
,
'您两次输入的密码不一致'
)
else
:
mess
.
showerror
(
'错误'
,
'密码或用户名不能为空'
)
def
login
():
# 登录验证
def
login
():
# 登录验证
pass
pass
...
@@ -27,7 +36,7 @@ class My_login(): # 登录窗口
...
@@ -27,7 +36,7 @@ class My_login(): # 登录窗口
def
show
(
self
):
# 登录界面的所有控件
def
show
(
self
):
# 登录界面的所有控件
# Label文本标签,界面提示信息
# Label文本标签,界面提示信息
l
=
tkinter
.
Label
(
self
.
root
,
text
=
'您好!请登录'
,
bg
=
'
green
'
,
l
=
tkinter
.
Label
(
self
.
root
,
text
=
'您好!请登录'
,
bg
=
'
lightblue
'
,
font
=
(
'宋体'
,
15
),
width
=
40
,
height
=
2
)
font
=
(
'宋体'
,
15
),
width
=
40
,
height
=
2
)
l
.
place
(
x
=
0
,
y
=
0
)
l
.
place
(
x
=
0
,
y
=
0
)
l
=
tkinter
.
Label
(
self
.
root
,
text
=
'用户名:'
,
font
=
(
"宋体"
,
12
),
l
=
tkinter
.
Label
(
self
.
root
,
text
=
'用户名:'
,
font
=
(
"宋体"
,
12
),
...
@@ -81,7 +90,7 @@ class My_register(): # 注册窗口
...
@@ -81,7 +90,7 @@ class My_register(): # 注册窗口
# Label文本标签,窗口界面文字:用户名、密码、确认密码
# Label文本标签,窗口界面文字:用户名、密码、确认密码
lab
=
tkinter
.
Label
(
self
.
root
,
text
=
'您好!请填写注册信息'
,
lab
=
tkinter
.
Label
(
self
.
root
,
text
=
'您好!请填写注册信息'
,
font
=
(
'宋体'
,
15
),
fg
=
"black"
,
width
=
40
,
height
=
2
,
bg
=
"green"
)
font
=
(
'宋体'
,
15
),
fg
=
"black"
,
width
=
40
,
height
=
2
,
bg
=
"
light
green"
)
lab
.
place
(
x
=
0
,
y
=
0
)
lab
.
place
(
x
=
0
,
y
=
0
)
lab1
=
tkinter
.
Label
(
self
.
root
,
text
=
'用户名:'
,
font
=
(
"宋体"
,
12
),
lab1
=
tkinter
.
Label
(
self
.
root
,
text
=
'用户名:'
,
font
=
(
"宋体"
,
12
),
fg
=
"black"
)
fg
=
"black"
)
...
...
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