Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #105777

Re: Another Key Binding Question

From MRAB <python@mrabarnett.plus.com>
Newsgroups comp.lang.python
Subject Re: Another Key Binding Question
Date 2016-03-26 17:47 +0000
Message-ID <mailman.51.1459014439.28225.python-list@python.org> (permalink)
References <g-OdncqhU4EbX2vLnZ2dnUU7-RnNnZ2d@giganews.com>

Show all headers | View raw


On 2016-03-26 17:10, Wildman via Python-list wrote:
> I use some key bindings in my program.  They are declared
> like this:
>
>          root.bind("<Alt_L>" + "q", quit)
>          root.bind("<Alt_R>" + "q", quit)
>          root.bind("<Alt_L>" + "Q", quit)
>          root.bind("<Alt_R>" + "Q", quit)
>
> The above binds both Alt keys with upper and lower case 'q'.
> Is there a way to combine the statements above into one
> statement?
>
Try this:

     root.bind("<Alt-q>", quit)
     root.bind("<Alt-Lock-Q>", quit)

The first is for either "Alt" key plus the "Q" key and Caps Lock turned off.

The second is for either "Alt" key plus the "Q" key and Caps Lock turned on.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Another Key Binding Question Wildman <best_lay@yahoo.com> - 2016-03-26 12:10 -0500
  Re: Another Key Binding Question MRAB <python@mrabarnett.plus.com> - 2016-03-26 17:47 +0000
    Re: Another Key Binding Question Wildman <best_lay@yahoo.com> - 2016-03-27 00:04 -0500

csiph-web