Tkinter problem Text edit_undo()/edit_redo() does not respond

This is because Textthe undoparameters that are not set Truecan be "activated" edit_undo()and after they are set edit_redo.
This error is difficult to find because it did not report an error. I checked a lot of information and found it.

I hope the pythonofficial can improve this in the future .
Sample code:

from tkinter import *

root = Tk()
root.title('Undo/redo test')
text = Text(root, undo=True)
#                 ^^^^^^^^^
#                   重要!
text.insert(END, 'Hello tkinter!')
text.edit_undo()
text.edit_redo()

root.mainloop()

Guess you like

Origin blog.csdn.net/write_1m_lines/article/details/105079212