serhiy-storchaka ยท GitHub

Feature or enhancement

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.

Linked PRs

Read the original on github.com โ†—