[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Using Pygame to capture key presses for CLI prgram?



James - thank you. I will have a look at your code.
I was getting the feeling that this is how Pygame works.

ÂPygame will Âread a USB gamepad without any display.
So, somehow a gamepad is different to a keyboard.

Again, thank you for your help.

Albert.


On 30 May 2013 03:50, James Paige [via pygame-users] <[hidden email]> wrote:
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:

> 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
> Sent from the pygame-users mailing list archive at Nabble.com.
>



If you reply to this email, your message will be added to the discussion below:
http://pygame-users.25799.x6.nabble.com/Using-Pygame-to-capture-key-presses-for-CLI-prgram-tp719p723.html
To unsubscribe from Using Pygame to capture key presses for CLI prgram?, click here.
NAML



View this message in context: Re: [pygame] Using Pygame to capture key presses for CLI prgram?
Sent from the pygame-users mailing list archive at Nabble.com.