I am trying to make a login app in python tkinter and I am not getting the output I expect.
Here is the output:
I don't want the username and password strings to show until I click Register.
Here is the code that handles the window(s):
from tkinter import *
def login():
print('Login Started')
def register():
screen1 = Toplevel(screen)
screen1.title('Register')
screen1.geometry('300x250')
username = StringVar()
password = StringVar()
Label(text = 'Username * ').pack()
Entry(textvariable = username)
Label(text = 'Password * ').pack()
Entry(textvariable = password)
def main_screen():
global screen
screen = Tk()
screen.geometry('300x250')
screen.title('notes')
Label(text = "Notes 1.0", bg = "grey", width = '300', height = '2', font = ("Calibri", 13)).pack()
Label(text = '').pack()
Button(text = 'Login', width = '30', height = '2', command = login()).pack()
Label(text = '').pack()
Button(text = 'Register', width = '30', height = '2', command = register()).pack()
screen.mainloop()
main_screen()