This is because Text
the undo
parameters that are not set True
can 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 python
official 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()