-3
I’m creating a simple system just to learn a little bit about the Tkinter library. However, I stopped right here.
The idea is to create several pages in the same code (I know that the correct one would modularize the code, but because it is a small project, everything together will serve). However, I would like to be able to press a button and thus travel from one page to another.
For example, I run the program and then I am shown Page 1.
When clicking the "Page 2" button, I should go to page 2. Where there should be a "Back" button that takes me back to Page 1.
And this process should take place with any page that I want to create. I want to ask for this help because all the codes I found were very confusing and/or did not work with separate pages where the button would call them.
Code:
from tkinter import *
import sys
janela1 = Tk()
b1 = Button(janela1, text="Janela 2")
b1.grid()
b2 = Button(janela1, text="Janela 3")
b2.grid()
janela1.geometry("200x100")
janela1.mainloop()
sys.exit()
janela2 = Tk()
b3 = Button(janela2, text="Voltar")
b3.grid()
janela2.geometry("200x100")
janela2.mainloop()
janela3 = Tk()
b4 = Button(janela3, text="Voltar")
b4.grid()
janela3.geometry("200x100")
janela3.mainloop()
Are "windows" or "pages"?
– Guilherme Nascimento
I think it doesn’t change much. I call window in code, but page for client.
– Ivi Fernando