Par*_*ppa 7 python macos terminal pygame
我在通过终端在Mac OS X上运行基于pygame的应用程序时遇到问题.键盘之类的输入事件会转到终端而不是我的Python应用程序,并由pygame检测到.
例如,我有以下测试脚本:
import pygame
pygame.init()
screen = pygame.display.set_mode((640, 480))
done = False
while not done:
    pygame.event.pump()
    keys = pygame.key.get_pressed()
    if keys[pygame.K_ESCAPE]:
        done = True
    if keys[pygame.K_SPACE]:
        print "got here"
当我从Mac OS X终端运行时,此脚本不会处理K_ESCAPE和K_SPACE,但终端将回显空格.
我正在运行pygame(py-game)的MacPorts端口,它取决于Python 2.4,我还使用python_select使python24成为活动版本.
| 归档时间: | 
 | 
| 查看次数: | 2055 次 | 
| 最近记录: |