I have found a post on stackoverflow (linked here), which has been very cool to test out, but I cannot for the life of me figure out how I would show page1, from page 2 for example. Normally this is done via MainView class, but I do not want this.
Here is the code:
#Thanks to Bryan Oakley
class Page(Frame):
def __init__(self, *args, **kwargs):
Frame.__init__(self, *args, **kwargs)
def show(self):
self.lift()
class Page1(Page):
def __init__(self, *args, **kwargs):
Page.__init__(self, *args, **kwargs)
label = Label(self, text="This is page 1").pack(side="top", fill="both", expand=True)
class Page2(Page):
def __init__(self, *args, **kwargs):
Page.__init__(self, *args, **kwargs)
label = Label(self, text="This is page 3").pack(side="top", fill="both", expand=True)
showp1 = Page1.show(root)
b1 = Button(self, text="Page 1",font='Helvetica 15 bold italic', command=showp1,bg='#444444',fg='white',padx=20)
b1.pack()
class MainView(Frame):
def __init__(self, *args, **kwargs):
Frame.__init__(self, *args, **kwargs)
p1 = Page1(self)
p2 = Page2(self)
some things I have tried calling from Page2:
Page1.show(root)
Page1.show(self)
Page1.show(Mainview(Root))
Page1.show(Page())
I've tried plenty more stuff, but cannot figure it out, if anyone can help, and maybe give me a short explanation, would be amazing! Thank you, and have a great day!