ScrolledText (over Tkinter.Text) validation

Fredrik Lundh fredrik at pythonware.com
Mon May 20 14:45:39 EDT 2002


"Phlip" wrote:
>
> I have liked to have intercepted the KeyPress event and removed
> the character before it went in, but the 'event' object was one-way.
>
> Does anyone have a better method?

the "Instance and Class Bindings" section on this page:

http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm

discusses a similar case.

the easiest solution is to return the string "break" from the
event handler.  (this prevents Tkinter from propagating the
event back to the standard handler).

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list