This is an old copy of the Python FAQ. The information here may be outdated.

I can't get key bindings to work in Tkinter: why?

An often-heard complaint is that keyboard event handlers bound to events with the bind method don’t get handled even when the appropriate key is pressed.

The most common cause is that the widget to which the binding applies doesn’t have “keyboard focus”. You can use the focus_set method to explicitly move keyboard focus to a widget. Most widgets can also be given keyboard focus by clicking on them (but not labels; see the takefocus option).


CATEGORY: tkinter


A Django site. rendered by a django application. hosted by webfaction.