This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Incorrect mouse and keyboard mapping
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Jah-On, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2020-04-28 02:06 by Jah-On, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (3)
msg367481 - (view) Author: Jah-On (Jah-On) * Date: 2020-04-28 02:06
Hi all,
On Ubuntu Cinnamon Remix, with python3, and tkinter,

canvas.bind("<1>", callback)
canvas.bind("<2>", callback)
canvas.bind("<3>", callback)
canvas.bind("<4>", callback)
canvas.bind("<5>", callback)

are now mapped to mouse buttons, instead of keyboard number buttons.
msg367504 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-04-28 07:08
On which platform and Python version they were mapped to keyboard number buttons?
msg367893 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-01 22:59
Sequences 'a' and '1' are unambiguously interpreted as abbreviating '<Keypress-a>' and '<Keypress-1>', and similarly for any other printable ascii char.  '<a>' is interpreted also as '<Keypress-a>', but there is no reason to add the brackets.  In any case, binding a specific printable key is fairly rare.  '<1>' is ambiguous is that it could also mean '<Button-1>'.  Since '1' is available to abbreviate '<Keypress-1>', tcl currently chooses the button interpretation, and has AFAIK for at least a decade or more.  In any case, what tcl does is not a Python bug, and it does not matter what it might have done in old versions.

Note.  Buttons 4 and 5 are used on Linux for a mousewheel.  On Windows, they correspond to actual buttons, if present.  I just tested with a mouse with two side buttons.  '<6>', etc, is seen as key-6.
History
Date User Action Args
2022-04-11 14:59:30adminsetgithub: 84594
2020-05-01 22:59:21terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg367893

resolution: not a bug
stage: resolved
2020-04-28 07:08:54serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg367504
2020-04-28 02:06:14Jah-Oncreate