Tkinter Return/Enter key handling
phil
phillip.watts at anvilcom.com
Wed May 18 21:27:29 EDT 2005
If you are talking Linux there's .Xdefaults
Which I had to resort to for tn5250.
For Tkinter apps its a LOT easier to just use bind.
Win32? dunno.
Bob Greschke wrote:
> I have a Tkinter Text() widget in a program that the user can type stuff
> into. Most of our keyboards have the regular keys with a "Return" key, and
> a numeric keypad with an "Enter" key. The Return key generates events with
> "<Return>" for the keysym, and the Enter key generates events with
> "<KP_Enter>" as the keysym. The Text() widget does a carriage
> return/linefeed when the Return key is pressed, but does nothing when the
> Enter key is pressed. So I did a
>
> Text.bind("<KP_Enter", Return)
>
> with a suitable
>
> def Return(e):
> TheText.insert(END, linesep)
>
> But isn't there a way to handle this with some sort of keyboard remapping
> thingy?? I'm right on the edge of understanding half of what I read about
> Tkinter. :)
>
> Thanks!
>
> Bob
>
>
>
More information about the Python-list
mailing list