Weird Loop Behaviour
Yigit Turgut
y.turgut at gmail.com
Fri Jan 20 15:47:47 EST 2012
More information about the Python-list mailing list
Fri Jan 20 15:47:47 EST 2012
- Previous message (by thread): etree/lxml/XSLT and dynamic stylesheet variables
- Next message (by thread): Weird Loop Behaviour
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
In the following code, I am trying to run "black" screen for 3 seconds
and respectively 2 seconds "white" screen. Black routine takes 3
seconds and white 2 seconds, 2 x black + white = 8 seconds which
should be the expected value but when I run it I get black-white-black-
white instead of black-white-black. Couldn't figure out what is
wrong thus sharing the code as well ;
white = False
while(end<8.00):
end = time.time() - start
if white:
screen.fill((255, 255, 255))
time.sleep(2)
else:
screen.fill((0, 0, 0))
time.sleep(3)
white = not white
pygame.display.update()
pygame.quit()
- Previous message (by thread): etree/lxml/XSLT and dynamic stylesheet variables
- Next message (by thread): Weird Loop Behaviour
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list