I just recently learned Python and Pygame library.
I noticed that the rendering and main loop is automatically paused when I click and hold on the window menu bar (the bar with the title/icon).
For example, in a snake game, the snake will be moving every frame. When I click and hold (or drag) the window menu, the snake is not moving anymore and the game is "paused". When I release it, it resumes.
Is there a way to let the game NOT pause when I drag the windows menu bar?
When you drag the window only the event queue gets stopped. So if your update/draw is not coupled with the event queue, they will not be paused.
from pygame.locals import *
import pygame
import sys
import time;
import random;
pygame.init()
DISPLAYSURF = pygame.display.set_mode((530, 212))
while True:
t = random.random();
t *= 255;
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
print event;
DISPLAYSURF.fill((int(t) % 255, int(t) % 255, int(t) % 255));
pygame.display.update()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With