[Tutor] Need to be able to accept Page Down or CTRL-E

Dave Wilder D.Wilder at F5.com
Fri Feb 1 04:19:39 CET 2013


>> On 01/31/2013 09:43 PM, Dave Wilder wrote:
>> Hello,
>>
>> In a script I am writing, I would like to be able to accept the PAGE DOWN key as an input  as well as the arrow keys.
>>
>> Is that possible w/ Python (I am using python 2.7.3 and Linux OS)?  If so, could someone point me to documentation on how to do that?
>>
>> I have done things like this before in python.  For example, I used the following to send the <ESC> character.
>> send (chr(27))
>>
>> However, I have not been able to find the ascii code equivalent to use for PAGE DOWN and the up/down arrow keys.
>>
>> I'm not even sure this is even a python question.
>>

> So how are you taking this input in?  If you're writing a terminal application, using raw_input(), it would be very difficult, as you'd probably have to modify the readline function.
> Perhaps you're using some GUI.  Please tell us which one.
>- DaveA

I am using a terminal application and an application called pexpect (instead of raw_input) where  I send something to the console and then look for a result, such as <PAGE DOWN> or
UP/DOWN arrows.  I'm not sure if pexpect is standard Python application.  I thought I recalled someone on this list saying it wasn't. 

Dave



More information about the Tutor mailing list