Undo and redo features in a Tkinter Text widget?
Asked Answered
U

2

11

I need to make both a Control + Z and Shift + Control + Z function in a Tkinter Text widget, so that one may undo and redo things.

Does anyone have an idea on how to do it?

Ur answered 2/7, 2010 at 21:56 Comment(0)
A
6

The tkinter Text widget supports undo and redo operations using a stack

At the following link you can find more information:

http://www.tkdocs.com/tutorial/text.html#more

Otherwise you could look at the tkinter or Tk docs for the Text widget and how to create a binding to some keys. The tkinter Text widget function you need is edit_undo.

Ashia answered 14/8, 2010 at 20:43 Comment(1)
this response is not complete and misses information. one broken link. the link to tkdocs doesn't explain anything.Two
Z
17

The Tkinter Text widget already supports undo with Control + Z and redo with Shift + Control + Z, but you have to enable them on the widget with undo=True. You might also want to use autoseparators=True and maxundo=-1. See this link https://www.tcl.tk/man/tcl8.5/TkCmd/text.htm#M65.

Zealot answered 4/10, 2015 at 9:48 Comment(0)
A
6

The tkinter Text widget supports undo and redo operations using a stack

At the following link you can find more information:

http://www.tkdocs.com/tutorial/text.html#more

Otherwise you could look at the tkinter or Tk docs for the Text widget and how to create a binding to some keys. The tkinter Text widget function you need is edit_undo.

Ashia answered 14/8, 2010 at 20:43 Comment(1)
this response is not complete and misses information. one broken link. the link to tkdocs doesn't explain anything.Two

© 2022 - 2024 — McMap. All rights reserved.