Hello
A beginner tkinter Python question, because I really don’t understand… When I run the code below, it returns the “else” side of the if-else function, if I enter two equal emailaddresses… Can you guys tell me what I did wrong ?
from tkinter import *
from tkinter import messagebox
def callback():
print(email.get())
return True
def Equal():
if email == email2:
print(“Your registration is completed”)
else:
print(“You entered two different emailaddresses”)
root = Tk()
root.title(‘Login’)
root.geometry(‘400x200’)
email = StringVar()
email2 = StringVar()
password = StringVar()
intro = Label(root, text="Do you already have an account? “).grid(column=0, row=0)
empty = Label(root, text=” ").grid(column=1,row=0)
L = Label(root, text="Emailaddress: ").grid(column=0, row=1)
E = Entry(root, textvariable=email, validate=“focusout”, validatecommand=callback).grid(column=1, row=1)
M = Label(root, text="Emailaddress: ").grid(column=0, row=2)
F = Entry(root, textvariable=email2, validate=“focusout”, validatecommand=callback).grid(column=1, row=2)
P_label = Label(root, text=“Password: “).grid(column=0, row=3)
P_Entry = Entry(root, show=”*”, textvariable=password).grid(column=1, row=3)
button1 = Button(root, text=“Login”, command=Equal).grid(column=2, row=4)
root.mainloop()
In the original code the tab spaces are correct, I see this isn’t in the published post here…
Thank you
Mattaqua