tkinter absorb chars

phil phillip.watts at anvilcom.com
Thu Mar 3 20:40:59 EST 2005


Jeff Epler wrote:

> 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")
> 
> Jeff
> 

Thanks, that helps.
But after noticing an'&' I want to 'disappear'
All characters form the field. But I need to process
those characters in the event handler.
I've already bound '<Key'> to inputevent.
Are you saying if I just do:  return 'break' from
inputevent the characters will never see light?

I'll try it.




More information about the Python-list mailing list