Commit 212cec14 by BellCodeEditor

save project

parent b7561945
Showing with 11 additions and 5 deletions
...@@ -30,17 +30,23 @@ def register(): # 注册验证 ...@@ -30,17 +30,23 @@ def register(): # 注册验证
with open("user.txt",'w',encoding='utf-8') as f: with open("user.txt",'w',encoding='utf-8') as f:
f.write(content) f.write(content)
reg_to_login() reg_to_login()
def login(): # 登录验证 def login(): # 登录验证
name,password = app_login.get_input() name,password = app_login.get_input()
pwd = users.get(name) pwd = users.get(name)
result = str(users) result = str(users)
if name in result: if n > 0:
if pwd == password: if name in result:
messagebox.showinfo("提示",'登陆成功') if pwd == password:
messagebox.showinfo("提示",'登陆成功')
else:
n=n-1
messagebox.showwarning('警告','密码错误','还剩'+str(n)+'次机会')
else: else:
messagebox.showwarning('警告','密码错误') n = n-1
messagebox.showwarning('警告','用户名错误','还剩'+str(n)+'次机会')
else: else:
messagebox.showwarning('警告','用户名错误') messagebox.showwarning('警告',"次数用尽")
class My_login(): # 登录窗口 class My_login(): # 登录窗口
def __init__(self): def __init__(self):
self.root = tkinter.Tk() self.root = tkinter.Tk()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment