0

I am new to programming so I would like ask is there any way to redirect to this window. I have tried searching on youtube and google but it did not tell me anything that could be of use. I have a login window that I want to be redirected to this window after a successful login.

class Admin:
    def __init__(self, root):
        self.root = root
        self.root.title("Covid 19 Admin Panel")
        self.root.geometry("1510x780+0+0")

         
if __name__ == "__main__":
    root = Tk()
    ob = Admin(root)
    root.mainloop()
Reti43
  • 9,656
  • 3
  • 28
  • 44
Edwin
  • 9
  • 1
  • You should probably make the different "windows" as frames and then switch between them (or destroy one and populate `root` with the other). See [here](https://stackoverflow.com/questions/7546050/switch-between-two-frames-in-tkinter) for more. – Reti43 Nov 04 '21 at 14:02
  • Ahh I've tried that but it just tells me admin is not defined and I changed it by doing class admin (tk.frame): – Edwin Nov 04 '21 at 14:15

1 Answers1

0
from tkinter import *

def main():
    win = Tk()
    win.geometry("480x480");
    win.title("Title");

    def login_redirect():
        win.destroy()
        login_page()

    login = Button(win, text="login", command=login_redirect)
    login.place(x=40,y=40)

    win.mainloop()

def login_page():
    win = Tk()
    win.geometry("480x480");
    win.title("Covid 19 Admin Panel")

main()
NikkieDev
  • 236
  • 3
  • 12