Commit 5b99c7ee by BellCodeEditor

save project

parent 145fe74a
Showing with 33 additions and 13 deletions
import tkinter
from tkinter import messagebox
import json
with open('user.txt','r',encoding='utf-8')as f:
info=f.read()
users=json.loads(info)
def login_to_reg(): # 登录界面转注册界面
pass
app_login.root.distroy
global app_reg
app_reg=My_register
app_reg.show()
def reg_to_login(): # 注册界面转登录界面
pass
app_reg.root.distroy
global app_login
app_login=My_login
app_login.show()
def register(): # 注册验证
pass
name,password1,password2=app_reg.get_input()
if name==" "or password1==" "or password2==" ":
messagebox.showwarning("警,请填完整资料。")
elif name in users:
messagebox.showwarning("错,名已在。")
elif password1 !=password2:
messagebox.showwarning("错,密不一致")
else:
users[name]=password2
content=json.dumps(users)
with open('user.txt','r',encoding='utf-8')as file:
file.write(content)
messagebox.showinto('成。')
login_show()
def login(): # 登录验证
pass
class My_login(): # 登录窗口
def __init__(self):
self.root = tkinter.Tk()
self.root=tkinter.Tk()
self.root.title("登录窗口")
self.root.geometry('400x300+500+300')
self.root.resizable(width=False, height=False) # True可以拉伸,False不能拉伸
def show(self): # 登录界面的所有控件
# Label文本标签,界面提示信息
l = tkinter.Label(self.root, text='您好!请登录', bg='green',
l = tkinter.Label(self.root, text='您好!请登录', bg='pink',
font=('宋体', 15), width=40, height=2)
l.place(x=0, y=0)
l = tkinter.Label(self.root, text='用户名:', font=("宋体", 12),
fg="black")
fg="yellow")
l.place(x=50, y=80)
l = tkinter.Label(self.root, text='密 码:', font=("宋体", 12),
l = tkinter.Label(self.root, text='密码:', font=("宋体", 12),
fg="black")
l.place(x=50, y=140)
# Entry单行文本输入框:用户名、密码
self.e1 = tkinter.Entry(self.root, show=None, font=('宋体', 14),
bg="light grey", width=18) # 显示成明文形式
self.e2 = tkinter.Entry(self.root, show='*', font=('宋体', 14),
self.e2 = tkinter.Entry(self.root, show='7', font=('宋体', 14),
width=18) # 显示成密文形式
self.e1.place(x=120, y=80)
self.e2.place(x=120, y=140)
......
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