I have some simple code here that is not behaving as I expected:
import pygame,sys
from pygame.locals import *
pygame.init()
window = pygame.display.set_mode((1300,700))
while True:
window.fill((0,0,0))
pygame.display.update()
#show black window, should happen before wait
pygame.time.wait(2000)
#program waits for 2 seconds, and then shows black window
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit(0)
The program waits for 2 seconds before updating the display and showing the black window. Why? Since python is an interpreted language, shouldnt pygame.display.update()
happen before pygame.time.wait(2000)
?