I am running K/Ubuntu 14.04 with ldmg and want to detect button pressure in pygame.
I am taking input from the keyboard and once the flag "include" is set, the window should close and we move onto the next in the list.
However the window refuses to close AND refuses to be closed manually using ALT + f4.
The code looks like:
image_name = "something.jpg"
image = pygame.image.load( image_name)
white = (255, 255, 255)
w = 640
h = 480
screen= pygame.display.set_mode((w,h))
screen.fill((white))
running = True
while running:
screen.fill((white))
screen.blit(image,(0, 0))
pygame.display.flip()
....
pygame.event.wait()
if pygame.event.peek():
pressed=pygame.key.get_pressed()
if pressed[K_LEFT]:
include = 1
running = False
elif pressed[K_RIGHT]:
include = 0
running = False
...
pygame.display.quit()
sys.exit()
I know that most of this code works fine...The window appears Ok, but I just can't get it to close properly - perhaps it's not even taking the key data properly.
Anyone any thoughts?