Python Curses - Unable to get TAB key

I need to catch the TAB key in Python. For any other keys:

x = self.myscreen.getch() if( x == curses.KEY_DOWN ): # and so.. 

What is the constant for the TAB key? I searched here (at the bottom of the page) and tried every TAB member.

I tried '\ t' too. Is it possible? thank you

+4
source share
2 answers

Try:

 if ( x == ord('\t')): ... 

or

 if ( x == 9): ... 

You must necessarily convert the character to an integer using ord () before comparing with the value from getch

+5
source

Try it , it looks like you are asking

-1
source

All Articles