Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add tkinter Text methods edit_canundo() and edit_canredo() #151674

Description

@serhiy-storchaka

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions