Detect a sequence of keystrokes in an os independent way

Rajanikanth Jammalamadaka rajanikanth at gmail.com
Wed Aug 20 17:44:35 EDT 2008


Hi!

I was able to do this in the following way:

import os

fKey= raw_input('')
if fKey=='ab':
        print(os.listdir(os.getcwd()))


Is there a better way to do this?

Thanks,

Raj

On Wed, Aug 20, 2008 at 2:21 PM, Rajanikanth Jammalamadaka
<rajanikanth at gmail.com> wrote:
> Hi!
>
> Can somebody tell me if there is an os independent way to detect a
> sequence of key strokes. For example, I want to start some other
> program once the user presses a couple of keys: ex: key a and then key
> b
>
> Thanks,
>
> Raj
>
> --
> "For him who has conquered the mind, the mind is the best of friends;
> but for one who has failed to do so, his very mind will be the
> greatest enemy."
>
> Rajanikanth
>



-- 
"For him who has conquered the mind, the mind is the best of friends;
but for one who has failed to do so, his very mind will be the
greatest enemy."

Rajanikanth



More information about the Python-list mailing list