I have a text widget with the "undo" option activated and a default message already inserted. In this case, how can I avoid affecting the default message using Ctrl+Z? In my mind it should work only for the new text inserted by the user but it always deletes all the text. How can I solve this issue?
In order to prevent Ctrl+Z to delete the default message inserted, call .edit_reset()
after inserting the message:
# assume text is the instance of the Text widget
text.insert("end", "This is the default message\n")
text.edit_reset()