Pergunta

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?

Foi útil?

Solução

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)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top