Pass variables/values from one frame to another -- Tkinter/Python Pass variables/values from one frame to another -- Tkinter/Python tkinter tkinter

Pass variables/values from one frame to another -- Tkinter/Python


You can achieve that (as you are having a clean parent-child relation of your windows) by using property style functions (getters/setters).

I personally would avoid creating the Confirm window like self.__controller.show_frame(Confirm).

You could create an instance of your class like self.__confirmFrame=Confirm() and then call the setters on self.__confirmFrame.

To get values back you could either create a event and bind on that or use getters and call them. Best practice here would be (my personal opinion) a combination of both - e.g. create an event at submit_btn click event and then bind the created event (e.g. "<< submit >>") in your parent frame to call the getters of the values you want. Same could be done (if neccessary) on cancel_btn click event.