Pygame : The game stops temporarily when I am moving the window

659 views Asked by At

I'm a new in PyGame and I was making a game. Until I discovered that when you were moving the window to another place of your desktop for example, the game temporarily stops. But ticks of the game still running when I used pygame.time.get_ticks().

So I made a completely new program with only the necessary code and it does the same thing.

Can someone explain me why it does it and if we can resolve this problem?

import pygame

screen = pygame.display.set_mode((800,600))
pygame.display.set_caption('The Test Program')

running = True
update_counter = 1

while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False

  pygame.display.flip()
  print(str(update_counter) + " updates")
  update_counter += 1


pygame.quit()
quit()
# So try to move the window across your screen and you will see that, prints will stop and they will resume when you will release the click
1

There are 1 answers

0
Kévin Grandjean On

So someone tell me that was normal, so I think it's only on Windows but there are no solutions. I put a script that show a pause symbol on screen when the cursor leave the window to make it normal.