Tkinter: text widget predefined key bindings

Fredrik Lundh fredrik at pythonware.com
Wed Sep 4 03:14:11 EDT 2002


Eric Brunel wrote:

> Yep, but it does not work in all cases: if you type accented characters,
> they are ignored by your undo; same if you do a XWindows-style paste
> (selecting, then Button2 anywhere in your Text widget). I suppose any text
> change done via any default binding will probably also be ignored...
>
> Believe me: it's really harder than it seems... We tried to do it once and
> it never worked correctly...

the "right" way to do this is to dynamically override the "insert"
and "delete" commands, on the Tcl level.

IDLE has code to do this.

(for true enlightenment, write your own keyboard controller, and
plug it in using bind_class...)

:::

I once wrote a patch to Tkinter that added bind_insert and
bind_delete methods to the standard text widget, but I seem
to have lost the code.  If I find it, I'll post it here:

    http://effbot.org/zone/tkinter-text-bind-insert-delete.htm

</F>





More information about the Python-list mailing list