I'm using PyGame on Ubuntu and I want to make a while loop that ends when the user presses any button on the keyboard.
This code does not leave the loop, and Eclipse gives no errors and no warnings but never leaves the loop. What is wrong?
import time
import pygame
pygame.init()
test = False
while not test:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
print "gotcha"
test = True;
break;
print "Still looping"
time.sleep(1);
print "made it out of the loop" ;
Ideally every second "still loopin" should be printed to the screen until I press any key, when "made it out of the loop" should be printed.
This doesn't happen: the loops continues forever (until I terminate the script).