Commit 3e7b1191 by BellCodeEditor

auto save

parent 145fe74a
Showing with 47 additions and 6 deletions
import tkinter
from tkinter import messagebox
import json
with open('user.txt','r',encoding='utf-8') as f:
user = f.read()
users = json.loads(user)
def login_to_reg(): # 登录界面转注册界面
pass
app_login.root.destroy()
global app_reg
app_reg = My_register()
app_reg.show()
def reg_to_login(): # 注册界面转登录界面
pass
app_reg.root.destroy()
global app_login
app_login = My_login()
app_login.show()
def register(): # 注册验证
pass
name,pd1,pd2 = app_reg.get_input()
if name == '' or pd1 =='' or pd2 == '':
messagebox.showwarning('警告你!','信息没有填写完整!')
elif name in users:
messagebox.showwarning('抱歉','用户名已存在')
elif pd1 != pd2:
messagebox.showwarning('傻x','两次密码不一样')
else:
messagebox.showwarning('恭喜','注册成功!')
def login(): # 登录验证
pass
......@@ -49,7 +71,7 @@ class My_login(): # 登录窗口
# 进入消息循环,监听事件
self.root.mainloop()
def get_input(self): # 获取输入的用户名、密码
def get_input(self): # 获取输入的用户、名密码
self.name = self.e1.get()
self.password = self.e2.get()
return self.name, self.password
......@@ -105,3 +127,22 @@ class My_register(): # 注册窗口
app_login = My_login()
app_login.show()
{"admin": "123456"}
\ No newline at end of file
{"python": "123456", "jj": "66"}
\ No newline at end of file
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