Reputation: 9
I can't say I'm new to pygame. But this is just wierd. I am currenty working on a medium-sized project and while testing I found a wierd bug: Surface object won't render upon calling pygame.display.update()
Using Python 3.7.0
I even tested this:
import pygame
from pygame.locals import *
pygame.init()
s = pygame.display.set_mode((800, 600))
a = pygame.image.load('black_rectangle.png')
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
quit()
s.fill((255, 255, 255))
a.blit(s, (400, 300))
pygame.display.update()
And all I could see was just a empty white screen.
Upvotes: 0
Views: 41
Reputation: 20478
You are blitting the white s
surface onto the black a
surface. Just swap s
and a
.
s.blit(a, (400, 300))
Upvotes: 1