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

Re: [pygame] Keyboard Problem



Hi,

I believe you need to pump the pygame event system for the keyboard 
(and other parts of pygame) to work properly.
see http://www.pygame.org/docs/ref/event.html#pygame.event.pump

hope that helps.
yours
//Lorenz


On Thu, 07 Jan 2010 03:05:41 -0500, Kris Schnee <kschnee@xxxxxxxxxx>
wrote:
> I'm having a problem with pygame.key.get_pressed(). Any ideas? Sample
code:
> 
> <code>
> 
> import pygame
> screen = pygame.display.set_mode((100,100))
> pygame.init()
> 
> def Go():
>      while True:
>          keys = pygame.key.get_pressed()
>          if keys[ pygame.K_SPACE ]:
>              return
>          pygame.display.update()
> 
> Go()
> 
> </code>
> 
> Result: Program doesn't react to hitting Space, and won't quit till
forced.