python做一个注册界面_Python 实现简单的登录注册界面

差不多和登录界面一样,然后不进行细细的说明了,有不懂地方的可以给下文邮件地址发邮箱。

def usr_sign_up():

def sign_to_Mofan_Python():

np = new_pwd.get()

npf = new_pwd_confirm.get()

nn = new_name.get()

with open(‘usrs_info‘,‘rb‘) as usr_file:

exist_usr_info = pickle.load(usr_file)

if np!= npf:

tk.messagebox.showerror(‘Error‘,‘Password and confirm password must be the same!‘)

elif nn in exist_usr_info:

tk.messagebox.showerror(‘Error‘,‘The user has already signed up!‘)

else:

exist_usr_info[nn] = np

with open(‘usrs_info.pickle‘,‘wb‘) as usr_file:

pickle.dump(exist_usr_info,usr_file)

tk.messagebox.showinfo(‘Welcome‘,‘You have successfully signed up!‘)

window_sign_up.destroy()

window_sign_up = tk.Toplevel(window)

window_sign_up.geometry(‘350x200‘)

window_sign_up.title(‘Sign up window‘)

new_name = tk.StringVar()

new_name.set(‘MrZhangxd@python.com‘)

tk.Label(window_sign_up,text = ‘Username:‘).place(x = 10,y = 10)

entry_new_name = tk.Entry(window_sign_up,textvariable = new_name)

entry_new_name.place(x = 150,y = 10)

new_pwd = tk.StringVar()

tk.Label(window_sign_up,text = ‘Password:‘).place(x = 10,y = 50)

entry_new_pwd = tk.Entry(window_sign_up,textvariable = new_pwd,show = ‘*‘)

entry_new_pwd.place(x = 150,y = 50)

new_pwd_confirm = tk.StringVar()

tk.Label(window_sign_up,text = ‘Confirm password:‘).place(x = 10,y = 90)

entry_comfirm_sign_up = tk.Entry(window_sign_up,textvariable = new_pwd_confirm,show = ‘*‘)

entry_comfirm_sign_up.place(x = 150,y = 90)

btn_comfirm_sign_up = tk.Button(window_sign_up,text = ‘Sign up‘,command = sign_to_Mofan_Python)

btn_comfirm_sign_up.place(x = 150,y = 130)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值