I need to catch TAB key in Python. For any other keys I do:
x = self.myscreen.getch()
if( x == curses.KEY_DOWN ):
# and so..
What's the constant for TAB key? I searched here (bottom of page) and tried every TAB contant.
I tried '\t' too. Is it possible? Thank you
Try:
if ( x == ord('\t')):
...
or
if ( x == 9):
...
You need to be sure to convert the character to an integer with ord() before comparing to the value from getch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With