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: curses getch returns wrong value
Type: Stage:
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: arbor, serhiy.storchaka
Priority: normal Keywords:

Created on 2021-08-19 13:30 by arbor, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg399917 - (view) Author: Robert T McQuaid (arbor) Date: 2021-08-19 13:30
This applies to Python 3.8 under Debian-11 Bullseye.

Under curses getch should return the value of curses.KEY_B2
(350 decimal) when pressing the keypad 5.  Instead it
returns 574.

The simple program following the signature block
illustrates the problem.

Robert T McQuaid
558 McMartin Road
Mattawa Ontario P0H 1V0

phone:  705-744-6274
email:  rtmq@fixcas.com


# Put the following lines in a file bug.py
# Run from a terminal with:  python3 bug.py

import curses as cs
def report(stdscr):
    print('press the keypad 5')
    global result
    result=stdscr.getch()
cs.initscr()
cs.wrapper(report)
print('KEY_B2 (decimal): '+str(cs.KEY_B2))
print('input decimal value: '+str(result))
msg399934 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2021-08-19 20:36
Your terminal emulator does not support this key. I tested it on Konsole and it returned 27. But on XTerm and on the Linux virtual console I get the expected result.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89119
2021-08-19 20:36:49serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg399934
2021-08-19 13:30:19arborcreate