After crashing my head against the monitor for 2 hours I realised that:
display.blit(mypic, posx, posy)
pygame.display.update()
would just not work (i.e. wouldn't blit anything on the screen) unless I call:
pygame.event.get()
Is this the weirdest bug on earth, or am I missing something?
I'm running pygame on python 2.7, mac os high sierra, and yes I would be the least surprised if this was due to the goddam incompatibility between pygame and mac os.
Any hint about what is going wrong here?
Example code:
import pygame
winWidth = 800
winHeight = 600
posx = 200; posy = 200
mypic = pygame.image.load("path_to_my_picture.jpg")
COL_BACKGROUND = (255,255,255)
DISPLAYSURF = pygame.display.set_mode((winWidth, winHeight))
pygame.init()
display.fill(COL_BACKGROUND)
display.blit(mypic, posx, posy)
# only including the following line it will blit the picture:
# pygame.event.get()
pygame.display.update()
I'm not 100% sure how it works with mac but I am assuming it is similar to windows in that if you don't call
pygame.event.get()
regularly the operating system thinks that the window has stopped responding and no longer updates it.This is mentioned under pygame.event.pump() in the events page of the Pygame documentation