tkinter absorb chars

Jeff Epler jepler at
Thu Mar 3 17:33:03 CET 2005

On Wed, Mar 02, 2005 at 04:58:03PM -0600, phil wrote:
> Sorry for the repost, but moderator
> jeld the last one,

We saw both posts.

> In a Tkinter entry field (or Pmw entry)
> how could I eat charactres?

create a binding on the widget for the particular character you want to
treat specially.  If you want to suppress that character, return the
string "break" from the binding.  Example:

from Tkinter import *
t = Tkinter.Tk()
e = Tkinter.Entry(t); e.pack()
e.bind("x", lambda event: "break")

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <>

More information about the Python-list mailing list