I am new at programming and I am doing some experiment with this login screen. I want to create some "User" and "Password" combination that can close the project when I click the button "Enter". This should destroy the whole database in the future, but I think thats more like a pro-programmer issue.
For now it kinda works, but it doesn't close the project.
Any idea whats wrong? (I know it only checks password for now, but I would like to fix the button problem first and then check if user is ok too)
import tkinter as tk
from tkinter import *
root = Tk()
root.title("Login")
root.geometry("157x160")
def submit():
name=name_var.get()
password=passw_var.get()
if password == "delete":
print("Closed")
command=root.quit
else:
print('User: ' + name)
print('Password: ' + password)
name_var.set("")
passw_var.set("")
name_var=tk.StringVar()
passw_var=tk.StringVar()
name_label = tk.Label(root, text = 'User', font=('calibre',10, 'bold'))
name_entry = tk.Entry(root,textvariable = name_var, font=('calibre',10,'normal'))
passw_label = tk.Label(root, text = 'Password', font = ('calibre',10,'bold'))
passw_entry=tk.Entry(root, textvariable = passw_var, font = ('calibre',10,'normal'), show="X")
sub_btn=tk.Button(root,text = 'Enter', command = submit)
name_label.place(x = 10, y = 10)
name_entry.place(x = 13, y =25)
passw_label.place(x = 10, y = 60)
passw_entry.place(x = 13, y = 75)
sub_btn.place(x = 48, y =120)
root.mainloop()