Tkinter Login

Make this window with Tkinter

myEntry = tkinter.Entry(window) # optionally add show="*" to mask passwords
myEntry.grid(row=0, column=1, padx=10, pady=10)
# use myEntry.get() to get the contents of the box

# add this code for a message box
import tkinter.messagebox
tkinter.messagebox.showinfo("Title", "Message")
#                  ^
#                  showinfo can be any of showinfo, showwarning, showerror,
#                  askquestion, askokcancel, askyesno or askretrycancel.

Saving to a Database

Forgot SQLite? https://vh7.uk/process

  1. Make a new SQLite database.
  2. When the user logs in check for their username in the database.

Don't put any users in the database yet or check for passwords!

Encrypting Passwords

Download passlib: https://vh7.uk/rubbed.

from passlib.apps import custom_app_context as pwd_context

## HASHING PASSWORD

hash = pwd_context("theuserspassword")
# now store `hash` in your database instead of the users password


## VERIFYING PASSWORD

# get `storedhash` from database
passwordOk = pwd_context("theuserspassword", storedhash)

if (passwordOk):
    print("You can haz access")
else:
    print("YOU SHALL NOT PASS!")

Prompt the user if they want to register then if yes put their username and password in the database.

Tkinter Login

By Jake Walker

Tkinter Login

  • 657