用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - python代码库

高级版登入系统(如需可运行版本请下载文件)

2020-09-05 作者:我是帅哥举报

[python]代码库

window = tk.Tk()
window.title('欢迎使用登录系统')
window.geometry('400x300')

def 条款声明():
   tkinter.messagebox.showinfo(title='条框声明(1)',message='1.此作品是heroy原创哦')
   tkinter.messagebox.showinfo(title='条框声明(2)',message='2.我的qq号为2101177878')
   tkinter.messagebox.showinfo(title='条框声明(3)',message='3.祝大家玩的开心!!!')

def 退出():
    go_back = tkinter.messagebox.askyesno('提示', '你要退出吗?')
    if go_back:
        window.destroy()
def 加qq():
   go_back = tkinter.messagebox.askyesno('提示', '你要加我qq吗?')
   if go_back:
      os.system('qq.bat')
menubar = tk.Menu(window)
filemenu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label='退出(quit)', command=退出)
menubar.add_cascade(label='加我qq(quick)', command=加qq)
window.config(menu=menubar)
canvas = tk.Canvas(window, width=400, height=135, bg='green')
image_file = tk.PhotoImage(file='pic.gif')
image = canvas.create_image(200, 0, anchor='n', image=image_file)
canvas.pack(side='top')
tk.Label(window, text='欢迎使用heroy登录系统',font=('Arial', 16)).pack()
tk.Label(window, text='用户名:', font=('Arial', 14)).place(x=10, y=170)
tk.Label(window, text='密码:', font=('Arial', 14)).place(x=10, y=210)
var_usr_name = tk.StringVar()
entry_usr_name = tk.Entry(window, textvariable=var_usr_name, font=('Arial', 14))
entry_usr_name.place(x=120,y=175)
var_usr_pwd = tk.StringVar()
entry_usr_pwd = tk.Entry(window, textvariable=var_usr_pwd, font=('Arial', 14), show='*')
entry_usr_pwd.place(x=120,y=215)
def usr_login():
    usr_name = var_usr_name.get()
    usr_pwd = var_usr_pwd.get()
    try:
            usr_file.close()
    if usr_name in usrs_info:
        if usr_pwd == usrs_info[usr_name]:
            tkinter.messagebox.showinfo(title='欢迎', message='你好! ' + usr_name)
        else:
            tkinter.messagebox.showerror(title='提示',message='错误:您的密码错误,请重试.')
    else:
        np = new_pwd.get()
        npf = new_pwd_confirm.get()
        nn = new_name.get()
        with open('usrs_info.pickle', 'rb') as usr_file:
            exist_usr_info = pickle.load(usr_file)
        if np != npf:
            tkinter.messagebox.showerror('提示', '错误:密码与确认密码必须相同!')
        elif nn in exist_usr_info:
            tkinter.messagebox.showerror('提示', '错误:用户已经注册!')
        else:
 
    tk.Label(window_sign_up, text='密码: ').place(x=10, y=50)
    entry_usr_pwd = tk.Entry(window_sign_up, textvariable=new_pwd, show='*')
    entry_usr_pwd.place(x=130, y=50)
 
    new_pwd_confirm = tk.StringVar()
    tk.Label(window_sign_up, text='确认密码: ').place(x=10, y=90)
    entry_usr_pwd_confirm = tk.Entry(window_sign_up, textvariable=new_pwd_confirm, show='*')
    entry_usr_pwd_confirm.place(x=130, y=90)
    btn_comfirm_sign_up = tk.Button(window_sign_up, text='注册(Sign up)', command=sign_to_Hongwei_Website)
    btn_comfirm_sign_up.place(x=180, y=120)
btn_login = tk.Button(window, text='登录(Login)', command=usr_login)
btn_login.place(x=80, y=250)
btn_sign_up = tk.Button(window, text='注册(Sign up)', command=usr_sign_up)
btn_sign_up.place(x=240, y=250)
btn_sign_up = tk.Button(window, text='条款声明', command=条款声明)
btn_sign_up.place(x=170, y=250)
window.mainloop()

[代码运行效果截图]


高级版登入系统(如需可运行版本请下载文件)

[源代码打包下载]




分享到:
更多

网友评论    (发表评论)

共2 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。