I am creating a login system, where a user enters a password and username, and on a button being pressed, it goes to the function to check the password.
from tkinter import *
def login():
Usr = Tk()
Usr.title("Login")
Usr.geometry("200x150+860+400")
Usr.configure(bg="grey22")
usrBox = Label(Usr, text = "Username:", font=( "arial",12, "bold"), fg="white", bg="grey22").place(x=50, y=10)
passbox = Label(Usr, text = "Password:", font=( "arial",12, "bold"), fg="white", bg="grey22").place(x=50, y=60)
usrName = StringVar()
usernameInput = ""
passwordInput = ""
PssWord = StringVar()
usrName = Entry(Usr, textvariable= usernameInput, width=15, bg="lightgrey").place(x=50, y=37)
PssWord = Entry(Usr, textvariable= passwordInput, width=15, bg="lightgrey").place(x=50, y=87)
enter = Button(Usr, text = "login", width=11, height = 1, bg="lightgrey", activebackground="grey", font=("arial", 10, "bold"), command = checkPassword: action(usernameInput, passwordInput)).place(x=50, y=110)
Usr.mainloop()
def checkPassword(usernameInput, passwordInput):
print(usernameInput, passwordInput)
login()
The action returns invalid syntax
command = lambda :checkPassword(usernameInput, passwordInput)usrBox = Label(...).place(x=50, y=10)is not the widget butNone. Also, the two "text variables" should be actualStringVarand not just plain strings.