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
  curses library autompav96 2 123 Mar-02-2019, 02:12 AM
Last Post: woooee
  Complex Long codes ayaz786amd 5 308 Dec-21-2018, 02:37 PM
Last Post: ichabod801
  Codes does not work NatalieG 3 237 Nov-29-2018, 08:05 PM
Last Post: NatalieG
  Pretty table and curses? MuntyScruntfundle 0 276 Oct-16-2018, 10:22 AM
Last Post: MuntyScruntfundle
  Python 3 escape codes oldDog 1 387 Sep-15-2018, 10:12 AM
Last Post: gruntfutuk
  Sending different color codes in python at certain times Kimzer 4 607 Jun-18-2018, 06:56 PM
Last Post: gontajones
  Putting many coordinates number inside codes fyec 1 448 Jun-07-2018, 01:09 AM
Last Post: scidam
  converting backslash codes Skaperen 4 1,859 Apr-21-2018, 04:07 AM
Last Post: Skaperen
  Two same codes, different result. Please help to understand. vickyprabhat 5 698 Mar-24-2018, 11:33 PM
Last Post: vickyprabhat
  curses.initscr doesn't work zaphod424 3 1,388 Feb-28-2018, 12:36 PM
Last Post: Gribouillis

Forum Jump:

Users browsing this thread: 1 Guest(s)