Q:

Python Tkinter - Save Entry input

I am trying to make a simple login system with Tkinter as practice and I want to have E2 input saved and preferably be printed in the console when I press 'Register', but it only outputs '.!entry2' and not the actual input.
import sqlite3 as sql
from tkinter import *

conn = sql.connect("database.db")
c = conn.cursor()
c.execute("""CREATE TABLE IF NOT EXISTS info(username TEXT, password TEXT)""")
conn.commit()

root = Tk()
root.title("Login Screen")
root.geometry("240x100")

def getInput():
    print(E2)

# --- Username/Password
L1 = Label(root, text="Username:").grid(row=0, sticky=E)
E1 = Entry(root).grid(row=0, column=1)

L2 = Label(root, text="Password:").grid(row=1, sticky=E)
E2 = Entry(root, show="*")
E2.grid(row=1, column=1)
# ---

C1 = Checkbutton(root, text="Remember me?").grid(row=3, column=1)

# --- Buttons
B1 = Button(root, text="Login").grid(row=4, column=0)
B2 = Button(root, text="Register", command=getInput).grid(row=4, column=1)
B3 = Button(root, text="Exit", command=root.destroy).grid(row=4, column=2)
# ---

root.mainloop()    

A:

You need to call E2.get(), for examples see here.
print(E2) prints the object itself.

