1

I've been searching on how to do it without pygame, but I haven't found a way.

Basically all I want to do is to press a key and play a sound, but I do not know how to register keystrokes in python.

edit: Forgot to mention, for Windows.

3
  • As I've stated in the original comment, I would like a way without pygame. Commented Aug 20, 2018 at 14:52
  • 1
    is this in the shell? or in a gui? Commented Aug 20, 2018 at 14:56
  • It's in pycharm Commented Aug 20, 2018 at 15:06

1 Answer 1

0

It (getting keypresses and playing sounds) is probably operating system specific, and you might want to use some widget toolkit (interfaced to Python). So consider using one of PyGTK, PyQt, PySDL2 or some other suitable toolkit. I guess that for a game, PySDL2 should be the most suitable.

You might focus on the WinAPI only and follow this.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.