When I press a button, I want to open a new side. Not a new window, the window should be the same, just the interface should change.
How can I solve this without opening a new window?
from tkinter import *
page1=Tk()
label1=Label(page1, text="This is page 1")
label1.pack()
def topage2():
page2=Tk()
label2=Label(page2, text="This is page 2")
label2.pack()
button=Button(page1, text="To page 2", command=topage2)
button.pack()
mainloop()
You could create two frames in the same place, and lifting them over one another using the lift and lower methods (example taken from Bryan Oakley here and slightly altered):
You could place 'page one' in one frame and 'page two' in the other