Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 curses key codes not working
I am attempting to use curses in python. I am finding that the keycodes are
possibly not correct.

here is some sample code I'm using to test the keys

c = stdscr.getch()
if c == curses.KEY_ENTER:
using this code, str(hex( c )) equals 0xa
and the value of str(hex(curses.KEY_ENTER)) equals 0x157
and the value of str(int(curses.KEY_ENTER)) equal 343

so a test like this is never true

if c==curses.KEY_ENTER:

will not work

I know I can test using another way. I'd prefer to use those constants

I found that tests for curses.KEY_LEFT and curses.KEY_RIGHT do work and the test for curses.KEY_BACKSPACE does not work

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How can I work this codes in Windows? herace 4 271 Jul-07-2019, 06:16 PM
Last Post: herace
  curses library autompav96 2 261 Mar-02-2019, 02:12 AM
Last Post: woooee
  Complex Long codes ayaz786amd 5 514 Dec-21-2018, 02:37 PM
Last Post: ichabod801
  Codes does not work NatalieG 3 336 Nov-29-2018, 08:05 PM
Last Post: NatalieG
  Pretty table and curses? MuntyScruntfundle 0 417 Oct-16-2018, 10:22 AM
Last Post: MuntyScruntfundle
  Python 3 escape codes oldDog 1 497 Sep-15-2018, 10:12 AM
Last Post: gruntfutuk
  Sending different color codes in python at certain times Kimzer 4 743 Jun-18-2018, 06:56 PM
Last Post: gontajones
  Putting many coordinates number inside codes fyec 1 543 Jun-07-2018, 01:09 AM
Last Post: scidam
  converting backslash codes Skaperen 4 2,044 Apr-21-2018, 04:07 AM
Last Post: Skaperen
  Two same codes, different result. Please help to understand. vickyprabhat 5 878 Mar-24-2018, 11:33 PM
Last Post: vickyprabhat

Forum Jump:

Users browsing this thread: 1 Guest(s)