I've got a program with a Tkinter-based GUI, using Python 3.6.5.
I have a temporary window with some Text widgets (and other things) in it. The whole window gets destroyed when the temporary window closes. However, I'd like to preserve undo/redo history and any text that is in some particular Text widgets the next time it is opened (and re-built). Reprogramming this another way is certainly possible, but may be an unnecessary and large amount of work, considering how things are set up (although if you have ideas that you feel should work no matter the setup, feel free to let me know). Changing the setup could probably easily introduce bugs.
Two different windows with different widgets need to share data between some of the similar widgets (and I want to extend that to include undo-redo history). I believe the different parents is part of why the window is destroyed, but I could be wrong (there may be other reasons).
Anyway, I was wondering, where is the undo/redo history of a Text widget stored? If I could just somehow copy that just before the window closes and put it in the newly build widget (of whichever window it gets build on), that would be great.
I'm adding the tk tag since I looked at the Python source code for tkinter and didn't find anything particularly useful (so maybe those who use TCL or such will know).
I realize that it may not be possible to access the variable that stores the history, but I figured it was worth asking about, just in case.
No, you cannot save the undo/redo history of the text widget, destroy the widget, then re-apply the history to a new widget. 
The best solution will be to not destroy the widget. Just hide it and then reshow it instead of destroying it and recreating it.
How to copy the undo/redo history of a Tkinter Text widget into another