A couple years ago I was trying to do something very similar. It wasn't
a raspbery pi, but it was a very small fanless linux box running debian.
In production, it had no monitor and never ran X. All the output was to
a serial LCD and all the input was from a barcode scanner that sent
keypresses as a keyboard.
I tried to use pygame for reading the input, but I finally gave up.
Without a window, pygame is just the wrong tool for the job.
I finally ended up using python's termios module. Here is a small
wrapper that I used http://pastebin.com/q9xMVUSb
I also found the timeout module handy in combination with reading raw
stdin, but whether or not it will be useful for your program I don't know.
---
James Paige
On Wed, May 29, 2013 at 05:05:59PM -0700, winkleink wrote:> Sent from the pygame-users mailing list archive at Nabble.com.
> Hi,
>
> I'm running pygame in a raspberry pi.
> The program I am writing has no graphical interface and I am connecting
> using SSH (Putty from a Windows XP computer)
>
> I want to capture a key press (with no graphical interface) and take action.
> Below is my code. ÂFrom what I can tell it should work.
>
> Any advice greatly appreciated.
>
>
>
>
>
> --
> View this message in context: http://pygame-users.25799.x6.nabble.com/Using-Pygame-to-capture-key-presses-for-CLI-prgram-tp719.html
>
http://pygame-users.25799.x6.nabble.com/Using-Pygame-to-capture-key-presses-for-CLI-prgram-tp719p723.htmlIf you reply to this email, your message will be added to the discussion below: