Thank you for quick reply. I just reinstalled SDL from homebrew, and upgraded pygame from pip. But unfortunately, same problem remained even after rebooting.
2017-03-03 18:41 GMT+09:00 René Dudfield <ren...@gmail.com>: > Hello, > > can you please try pygame 1.9.3 from pip? > > I've seen this problem before with an old install... and it's working now. > If you are using homebrew, it might mean that you also need to upgrade sdl > libs. > > > cheers, > > > On Fri, Mar 3, 2017 at 10:03 AM, Mick O'shey <mickau...@gmail.com> wrote: > >> Hello, >> >> When I ran the code below on mac os sierra, both of console window and >> pygame.display window kept focused. Then I typed something, letters went >> directly to console without going through the key events in the program. >> Escape key also didn't let me out of the program. >> >> However people on irc (all on linux) couldn't reproduce the problem, >> assuming this could be one of the mac-specific problems. >> >> I am using python 3.5.2(pyenv install) with pygame 1.9.2b6. Are there any >> way to avoid this problem? >> (please excuse my English mistakes if any) >> >> ---------- >> import pygame >> >> pygame.init() >> >> pygame.display.set_mode((100, 100)) >> pygame.display.set_caption('keyname') >> >> print('ready. ' + pygame.ver) >> running = True >> clock = pygame.time.Clock() >> while running: >> clock.tick(60) >> for e in pygame.event.get(): >> # e = pygame.event.wait() >> if e.type == pygame.QUIT: >> running = False >> elif e.type == pygame.KEYDOWN: >> if e.key == pygame.K_ESCAPE: >> running = False >> else: >> keyname = pygame.key.name(e.key) >> print('key is pressed: ' + keyname) >> >> elif e.type == pygame.KEYUP: >> keyname = pygame.key.name(e.key) >> print('key is released: ' + keyname) >> >> # pygame.display.update() >> >> pygame.quit() >> ---------- >> > >