I am seeking a method that can have the functionality of joining the undo/redo stack of the Tkinter Text widget written in the Python language. Is there something like the method to merging the user input undo/redo stack programmatically, or merging the programmatic changes to the Tkinter Text widget programmatically?
For example, I want to have the following:
import tkinter as tk
root = tk.Tk()
root.title("Stackoverflow question")
text = tk.Text(root)
text.some_method()
text.insert(tk.END, "a")
text.insert(tk.END, "b")
text.insert(tk.END, "c")
text.reversing_method()
text.pack()
root.mainloop()
As you can see, after calling some_method
, the user will have undone the whole string "abc" (and of course, after redo the steps, the string "abc" will be back again in pairs but not in sequence of "a", "b", and "c") after the text is entered programmatically (and by user). However, I would like to seek a method also, when the reversing_method
is called, the user can undo the text entered programmatically or by them single-by-single.