So for my project when I click a button - the page must navigate to another. And when I do this each time it creates a different window (hence resulting in a lot of windows) or keeps stacking on top of each other
Currently I have a admin/student choice page. And if I click on the student page it will run the student log in function and this applies the same for the admin.
I want to keep the background of the windows consistent as well - but I am unable to do so and on top of that I have no clue on how to navigate via the pages - I have looked at a few videos but I did not really understand it.
contains 2 buttons admin and student which should navigate to different "windows" when clicked
def mainPage():
""""Starting Page - which navigates to the approporate login, when user logs it navigates back to this window"""
root = Tk()
root.geometry('1024x600')
load = PIL.Image.open('Image//book.jpg')
render = ImageTk.PhotoImage(load)
img =Label(root, image = render)
img.place(x=0, y=0)
my_font = font.Font(size = 15)
buttonFrame = Frame(root, width = 600, height=300, bg="grey")
buttonFrame.grid(row = 0, column = 0, padx= 10, pady=2, sticky="")
label = Label(buttonFrame, text = "Pick a Log-in", bg = "white", font=my_font).grid(row = 1, column=1, sticky="", padx=10, pady=10)
button = Button(buttonFrame, text = "Admin",command = adminLogin, width=30, height = 5, font=my_font).grid(row=2, column=1, sticky = "", padx= 10, pady=10)
button2 = Button(buttonFrame, text = "Student", command = studentLogin, width = 30, height=5, font=my_font).grid(row = 3, column=1, sticky="", padx = 10, pady=10)
root.mainloop()
def studentLogin():
root = Tk()
root.geometry('1024x600')
load = PIL.Image.open('Image//book.jpg')
render = ImageTk.PhotoImage(load)
img =Label(root, image = render)
img.place(x=0, y=0)
my_font = font.Font(size = 15)
buttonFrame = Frame(root, width = 600, height=600, bg="grey")
buttonFrame.grid(row = 0, column = 0, padx= 10, pady=2, sticky="")
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
label = Label (buttonFrame, text="Welcome", font=('Helvetica', 18, 'bold'), bg="white").grid(row = 1, column = 1,sticky="", padx=10, pady=10)
label = Label(buttonFrame, text="Username", font = my_font).grid(row=2, column=1, padx=10, pady=10)
usernameEntry = Entry(buttonFrame).grid(row=2, column=2, padx=10, pady=10)
root.mainloop()