Reputation: 23
It looks like in pygame, screen command, like in screen.fill() is not in pygame. How do I set the background color?
Here is the code if needed:
pygame.display.set_mode([800, 600])
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
screen.fill((0, 0, 0))
pygame.display.update()
Upvotes: 1
Views: 33
Reputation: 210968
screen
is not a built-in variable. It seems that in your case screen
should be the pygame.Surface
object associated with the display. This pygame.Surface
is returned when the Pygame window is created with pygame.display.set_mode()
:
screen = pygame.display.set_mode([800, 600])
The other option is to get the display Surface with pygame.display.get_surface()
screen = pygame.display.get_surface()
screen.fill((0, 0, 0))
Upvotes: 2