I'm using Pygame to display animated full screen images on my second monitor. However, as soon as I click any window on the first monitor, the Pygame window closes. How can I prevent that?
Note that this happens only on my linux machine, on Mac OS the windows stays open.
Here's some reduced code:
import pygame
import pygame.locals
pygame.init()
windowSurface = pygame.display.set_mode((1280, 1080), pygame.locals.FULLSCREEN)
img = pygame.image.load("someimage.png")
running = True
while running:
windowSurface.blit(img, (0, 0))
pygame.display.flip()
for event in pygame.event.get():
if (event.type == pygame.locals.QUIT or
(event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE)):
print("QUIT!")
running = False
pygame.quit()
Note that opening the window initially is not the problem, the image loads just fine.