![]() |
curses key codes not working - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: curses key codes not working (/thread-16016.html) |
curses key codes not working - jgrillout - Feb-11-2019 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 stdscr.keypad(True) 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 |