I'm trying to run a very basic pygame application, however I cannot get it to draw content to, or even fill the screen. I do update the screen in the main loop after filling it, however the screen stays blank and does not color black.
Printing inside the run function prints 60 times every second as expected. I do run MacOS Catalina which may be the problem, although I did not find any other mention of this problem.
import pygame
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
class Simulator:
running = True
def __init__(self):
pygame.init()
self.screen = pygame.display.set_mode((800, 600), 0, 32)
self.clock = pygame.time.Clock()
pygame.display.set_caption('Traffic Simulator')
def run(self):
while (self.running):
for e in pygame.event.get():
if (e.type == pygame.QUIT):
self.running = False
self.screen.fill(BLACK)
pygame.display.flip()
pygame.display.update()
self.clock.tick(60)
if __name__ == "__main__":
sim = Simulator()
sim.run()
pygame.quit()
It shows a window with the title 'Traffic Simulator' with the default system color grey in the window, which I expect to be black.