1

I'm running python3 on a Macbook pro 10.9.5.

I'm not sure what's happening but it doesn't appear the keystrokes I'm entering is making it to the game window, even if I click my focus to the game window.

The code I'm running is from the Invent with Python website. In a Terminal window, I run

python3 pygameInput.py

Another window with the game/demo images appear. I click on the game window so the focus should be with the game. However, I can see in the spawning window, a-d-w-s and ^[[D^[[C^[[B^[[A (up, down, left, right, arrows). The images don't move, I think because the keystrokes are going to the wrong window, even though the focus is on the game window.

Is there some setting I need to change for the Terminal windows to make this work or am I messing up on something so easy that I must forever hang my head in shame on SO? I can attach screenshots if needed. Thanks in advance for your help.

UPDATE: I thought I should also mention I'm running pygame 1.9.2a. I might try with 1.9.1 later to see if the difference in version is affecting me. Also, I put some debug msgs in the code and it seems like the event.get() call is getting something b/c it seems like it catches when I click with my mouse but it doesn't seem to catch the keystrokes. I will update some more if I find out more.

Classified
  • 5,759
  • 18
  • 68
  • 99
  • I used python2.7 to run the program and the program is accepting keystrokes. I'm guessing pygame has bugs with python3.4. – Classified Mar 04 '16 at 01:53

0 Answers0