Commit c48eb808 by BellCodeEditor

save project

parent 307ac72d
Showing with 56 additions and 0 deletions
import tkinter
import json
# 初始化字典
usr_dc = {}
# 初始化提交事件
def register():
usr_name = usr.get()
usr_psword = psword.get()
usr_dc = {usr_name:usr_psword}
usr_h = str(usr_dc)
file = open('user.txt','w')
file.writelines(usr_h)
file.close()
print(usr_dc)
# 建立窗口对象
root = tkinter.Tk()
root.title("注册") # 设置窗口标题
root.geometry("400x320+500+300") # 设置窗口大小
root.resizable(width=False, height=False) # 禁止拉伸窗口
# 用户输入框
usr = tkinter.Entry(root,show=None,font=('微软雅黑',14),bg="light grey",width=18) # 显示成明文形式
usr.place(x=140, y=80)
usr_text = tkinter.Label(root,text="用户名:",font=("微软雅黑",12),
fg="black")
usr_text.place(x=60,y=80)
# 密码输入框
psword = tkinter.Entry(root,show="*",font=("微软雅黑",14),bg="light grey",width=18)
psword.place(x=140,y=140)
psword_text = tkinter.Label(root,text="密 码:",font=("微软雅黑",12),
fg="black")
psword_text.place(x=60,y=140)
# 确认密码输入框
psword_sc = tkinter.Entry(root,show="*",font=("微软雅黑",14),bg="light grey",width=18)
psword_sc.place(x=140,y=200)
psword_sc_text = tkinter.Label(root,text="确认密码:",font=("微软雅黑",12),
fg="black")
psword_sc_text.place(x=60,y=200)
# 注册Tab欢迎栏栏
lab = tkinter.Label(root, text='您好!欢迎来到建安市第一化工厂', font=('微软雅黑', 12),
fg="white",width=40, height=2,bg="green")
lab.place(x=0,y=0)
# 提交Button
button_push = tkinter.Button(root,text="Push at Database",bg="lightyellow",width=15
,command=register)
button_push.place(x=150, y=250)
# 保持窗口监听
root.mainloop()
{'admin': '114514'}
\ 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