How can redirect the user to another window without having to make pop up 2 windows

105 views Asked by At

How can I redirect the user to another window without having to pop up two windows after user logs in with username/password?

from  tkinter import *
import sys

#_________USERNAME&PASSOWRD_______________________
username = 'gjergjk71'
password = 'gjergji.123'
#__________LOGIN FUNCTION_________________________
def other_window():
    root1 = Toplevel()
    root1.minsize(width=1000,height=700)
    root1.mainloop()

def login1(*args):
    if login_input.get() == username and password_input.get() == password:
        MESSAGE.set("LOGGED IN SUCCESFULLY!")
        other_window()
    else:
        MESSAGE.set("[error] Username or Password incorrect !")

def about():
    print("dadsa")
    MESSAGE.set("""Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
    Cras quis venenatis lectus. Maecenas 
    et molestie eros. Nullam ornare sagittis justo 
    quis molestie. Suspendisse pretium lacinia volutpat. 
    Quisque tempus augue nibh, et mattis elit fermentum id. Inte
    ger scelerisque vehicula tempor. Maecenas elit neq
    ue, imperdiet non pretium et, vulputate quis nunc.
    Sed ac pulvinar leo. Praesent condimentum urna et massa aliqua
    """)
def help():
    MESSAGE.set("""ndisse pretium lacinia volutpat. 
    Quisque tempus augue nibh, et mattis elit fermentum id. Inte
    ger scelerisque vehicNullam ornare sagittis justo 
    quis molestie. Suspea tulLorem ipsum dolor sit amet, consectetur
    adipiscing elit. Cras quis venenatis lectus. Maecenas 
     et molestie eros. empor. Maecenas elit neq
    ue, imperdiet non pretium et, vulputate quis nunc.
    Sed ac pulvinar leo. Praesent condimentum urna et massa aliqua

    """)

#______________________________________
#______________________________________


root = Tk()
root.title("BUSINESS MENAGEMENT")

menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
menubar.add_command(label="ABOUT",command=about)
menubar.add_command(label="HELP",command=help)
root.config(menu=menubar)

Label1 = Label(root, text="CodeSCHOOL", font=("Helvetica",26))
Label1.configure(text="BUSINESS MENAGEMENT")
Label1.pack()

Label2= Label(root,text="USER LOGIN", font=("Helvetica",20))
Label2.pack()

login_input = StringVar()
Login = Entry(root,textvariable= login_input)
Login.pack()

Label3= Label(root,text="USER PASSWORD", font=("Helvetica",20))
Label3.pack()

password_input = StringVar()
Password1 = Entry(root,textvariable= password_input, show="*")
Password1.pack()

Button1= Button(root,text="LOGIN",command=login1)
Button1.pack()

MESSAGE = StringVar()
message1 = Label(root,textvariable=MESSAGE).pack()

root.bind("<Escape>",sys.exit)
root.bind("<Return>", login1)

root.mainloop()
0

There are 0 answers