I have a GUI in tkinter, and I want to understand how to switch from a frame to another. I mean, if I click a button on my GUI I want to switch to another frame that show the result returned from action related to that button, and in the same frame I want a button "return home" to switch new to the home frame. I attach the code.
if __name__ == '__main__':
[...]
client = Client(url)
w = Fullscreen_Window()
bottone_visualizza_ricetta_attuale = tk.Button(text="Visualizza ricetta attuale", command= lambda: visualizza_ricetta_attuale(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_visualizza_ricetta_attuale.grid(row=0, column=1, sticky="W")
bottone_visualizza_lista_ricette = tk.Button(text="Visualizza lista ricette", command= lambda: visualizza_lista_ricette(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_visualizza_lista_ricette.grid(row=1, column=1, sticky="W")
bottone_avvio_selezione = tk.Button(text="Avvia la selezione", command= lambda: avvio_selezione(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_avvio_selezione.grid(row=2, column=1, sticky="W")
bottone_stop_selezione = tk.Button(text="Termina la selezione", command= lambda: stop_selezione(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_stop_selezione.grid(row=3, column=1, sticky="W")
bottone_cambia_velocita = tk.Button(text="Cambia velocità sezione o vibratore", activebackground="YELLOW",height=5,bd=4,width=30)# command=#TODO)
bottone_cambia_velocita.grid(row=4, column=1, sticky="W")
bottone_arresta_vibratori_sezione = tk.Button(text="Arresta i vibratori di una sezione", activebackground="YELLOW",height=5,bd=4,width=30)# command=#TODO)
bottone_cambia_velocita.grid(row=5, column=1, sticky="W")
bottone_avvio_svuota_residuo = tk.Button(text="Avvia svuotamento residuo", command= lambda:svuota_residuo(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_avvio_svuota_residuo.grid(row=6, column=1, sticky="W")
bottone_stop_svuota_residuo = tk.Button(text="Termina svuotamento residuo", command= lambda:fine_svuotamento_residuo(client), activebackground="YELLOW",height=5,bd=4,width=30)
bottone_stop_svuota_residuo.grid(row=7, column=1, sticky="W")
bottone_seleziona_ricetta = tk.Button(text="Seleziona una ricetta", activebackground="YELLOW",height=5,bd=4,width=30)# command=#TODO)
bottone_seleziona_ricetta.grid(row=8, column=1, sticky="W")
w.tk.mainloop()
def visualizza_ricetta_attuale(client):
return "eseguita la funzione visualizza ricetta attuale"
[..]