Commit eee04ed1 by BellCodeEditor

save project

parent 951042a3
Showing with 12 additions and 4 deletions
import tkinter import tkinter
from tkinter import messagebox
def reqister(): def reqister():
name = e1.get() name = e1.get()
a = e2.get() a = e2.get()
b = e3.get() b = e3.get()
with open('uesr.txt','r',encoding='UTF-8') as f:
info = f.read()
users = info
def reqister():
if name == '' or password == '' or password2 == '':
messagebox.showwarning('警告','请填写完整的信息资料')
# 建立窗口对象 # 建立窗口对象
root = tkinter.Tk() root = tkinter.Tk()
root.title("注册") # 设置窗口标题 root.title("注册") # 设置窗口标题
...@@ -14,10 +22,10 @@ root.geometry("400x320+500+300") # 设置窗口大小 ...@@ -14,10 +22,10 @@ root.geometry("400x320+500+300") # 设置窗口大小
e1 = tkinter.Entry(root,show=None,font=('宋体',14),bg="light grey",width=18) # 显示成明文形式 e1 = tkinter.Entry(root,show=None,font=('宋体',14),bg="light grey",width=18) # 显示成明文形式
e1.place(x=120, y=80) e1.place(x=120, y=80)
# 密码输入框,左上角坐标:x:140,y:140 # 密码输入框,左上角坐标:x:140,y:140
e2 = tkinter.Entry(root,show='*',font=('宋体',14),bg='light green',width=18) e2 = tkinter.Entry(root,show='&',font=('宋体',14),bg='light green',width=18)
e2.place(x=120,y=140) e2.place(x=120,y=140)
# 确认密码输入框,左上角坐标:x:140,y:200 # 确认密码输入框,左上角坐标:x:140,y:200
e3 = tkinter.Entry(root,show='*',font=('宋体',14),bg='light green',width=18) e3 = tkinter.Entry(root,show='@',font=('宋体',14),bg='light green',width=18)
e3.place(x=120,y=200) e3.place(x=120,y=200)
...@@ -35,7 +43,7 @@ lab3 = tkinter.Label(root, text='确认密码:',fg="black",width=10, height=2) ...@@ -35,7 +43,7 @@ lab3 = tkinter.Label(root, text='确认密码:',fg="black",width=10, height=2)
lab3.place(x=40,y=190) lab3.place(x=40,y=190)
bt=tkinter.Button(root,text='登录',font=('宋体',15),fg='black',command = reqister) bt=tkinter.Button(root,text='注册',font=('宋体',15),fg='black',command = reqister)
bt.place(x=180,y=260) bt.place(x=180,y=260)
# 保持窗口监听,进入消息循环 # 保持窗口监听,进入消息循环
root.mainloop() root.mainloop()
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