views:

40

answers:

1

I need to make both a Control-Z and Shift-Control-Z function in Python. Anyone have any Idea?

Also I need to select the contents of an entire text widget, anyone know how to go about that?

+1  A: 

For the undo mechanism, check the UndoDelegator.py of Idle in combination with EditorWindow.py.

To select the entire contents of a Text widget, you can do:

# remove previous selection, if any
text_widget.tag_remove(Tkinter.SEL, "1.0", Tkinter.END)
# select all
text_widget.tag_add(Tkinter.SEL, "1.0", Tkinter.END)
# place cursor
text_widget.mark_set(Tkinter.INSERT, Tkinter.END)
ΤΖΩΤΖΙΟΥ
Awesome, thanks!
Anteater7171