I want to display a form with a username and password, and in simple case I tried to print the entered username and password.
In my code, when I pressed the submit button the username and password are not printed from the other function.
Can anyone please help with it. The 'username' and 'password' needs to be printed.
def activation():
activate = Tk()
activate.title("Account Login")
w = 600
h = 400
ws = activate.winfo_screenwidth()
hs = activate.winfo_screenheight()
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)
activate.geometry("%dx%d+%d+%d" % (w, h, x, y))
global username_entry
global password_entry
username_entry = StringVar()
password_entry = StringVar()
Label(activate,text='Activation Number').grid(row=1,column=1,sticky='we')
Entry(activate, width=40, textvariable=username_entry).grid(row=1, column=2, columnspan=2)
Label(activate,text='Password').grid(row=2,column=1,sticky='we')
Entry(activate, width=40, show='*', textvariable=password_entry).grid(row=2,column=2,columnspan=2)
remember_me=BooleanVar()
Checkbutton(activate,text='Remember Me',variable=remember_me).grid(row=3, column=2)
Button(activate,text='Submit',command=login_verify).grid(row=3,column=3)
def login_verify():
username=username_entry.get()
password=password_entry.get()
print(username)
print(password)
print('1')