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

Re: [pygame] Requesting a hand with a simple Death Counter



Capturing keystrokes in the background is something I've had a lot of problems with too. On Windows, the PyHook module works great for this, as does the win32api module. Something like:

      # keyboard c
      i = win32api.GetAsyncKeyState(67)
      if i < 0:
        print "pressed!"

That doesn't require focus.Â

I've never solved this riddle on other OS's though, and have resorted to using joystick buttons in Pygame, which always work in the background no matter the OS (and you can easily wire into most joystick buttons if you don't mind a little soldering).Â

If possible please post if you figure out how to capture keystrokes in the background through another method.




On Mon, Oct 27, 2014 at 8:48 PM, PBRGamer <PBRGamerSNES@xxxxxxxxx> wrote:
Fantastic! Thank you for the assist!

I also learned that I needed to make sure that deathcounter.txt wasn't named
deathcounter.txt.txt : Thanks a lot windows.

I do have one singular issue. I can't seem to get it to capture the
keystrokes when it's in the background.

Is there an operand I need to change or add in order to get it to capture
keystrokes at all times or am I missing something else entirely.



--
View this message in context: http://pygame-users.25799.x6.nabble.com/Requesting-a-hand-with-a-simple-Death-Counter-tp1481p1484.html
Sent from the pygame-users mailing list archive at Nabble.com.