You need to learn about "break" and bindings.  When you return the
string "break" from a binding, any subsequent binding that would have
been executed (such as the default one for inserting characters into an
entry widget).

Here's a simple program that uses 'return "break"':
    import Tkinter

    def modified_inserter(event):
        event.widget.insert(Tkinter.INSERT, "b")
        return "break"

    e = Tkinter.Entry()
    e.bind("a", modified_inserter)
    e.pack()
    e.focus()
    e.mainloop()
It doesn't get everything right (for instance, it doesn't delete any
selected text in the entry before inserting) but it shows the general
principle.

Jeff

Attachment: pgpCn4YeLQl3B.pgp
Description: PGP signature

_______________________________________________
Tkinter-discuss mailing list
[email protected]
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to