You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add tkinter Text methods edit_canundo() and edit_canredo() #151674
The Tk text widget supports the pathName edit canundo and pathName edit canredo subcommands, which report whether the undo and redo stacks are non-empty. tkinter currently wraps edit modified, edit redo, edit reset, edit separator and edit undo, but not edit canundo/edit canredo. They are only reachable through the generic, undocumented Text.edit() passthrough.
I propose adding two convenience methods to tkinter.Text:
edit_canundo() — return True if undo is possible (the undo stack is not empty), False otherwise.
edit_canredo() — return True if redo is possible (the redo stack is not empty), False otherwise.
Both return a proper bool.
Links to previous discussion
This is one of a few Tk text subcommands not yet wrapped by tkinter; sync/pendingsync are tracked separately.
Thank you for advancing the tkinter wrapping of tk. I don't know if I would ever use these, and the sync methods, but I am in favor of having them available.
Activity
pythongh-151674: Add tkinter Text.edit_canundo() and Text.edit_canredo()
terryjreedy commentedon Jun 20, 2026
Thank you for advancing the tkinter wrapping of tk. I don't know if I would ever use these, and the sync methods, but I am in favor of having them available.
gh-151674: Add tkinter Text.edit_canundo() and Text.edit_canredo() (G…
serhiy-storchaka commentedon Jun 20, 2026
I plan to add wrappers for all Tk commands, if they makes any sense.
pythongh-151674: Add tkinter Text.edit_canundo() and Text.edit_canred…