0

I know that you can set undo=True for a Text widget, and then press CTRL + Z and CTRL + Y for undo and redo.

But I was wondering if there was a function I could bind to a button or something like that.

nbro
  • 15,395
  • 32
  • 113
  • 196
Henry Zhu
  • 2,488
  • 9
  • 43
  • 87
  • 1
    I'm not sure what you mean. Can you rephrase or be more specific in what you want to do? – Nolan Akash Aug 22 '15 at 00:17
  • You mean, you want to bind a `Button` widget in the GUI to undo/redo? That seems like a really annoying way to undo/redo. May I ask why you want this feature? – TigerhawkT3 Aug 22 '15 at 00:29
  • This article might also be useful to understand better how undos and redos work: http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-undo-stack.html – nbro Aug 22 '15 at 02:05

1 Answers1

1

The text widget has both an edit_undo() and edit_redo() method, which is what the built-in bindings use. You can call these methods from a button or menu item if you wish.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685