0

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
  • when I run on Linux Mint (with PyGame 1.9.6) then it prints all time - so it may depends on system which you use. Maybe some systems stop running code when you move window - and maybe it is normal thing in your system. – furas May 14 '20 at 05:59
  • While also not having a clear answer, this is the same question: https://stackoverflow.com/questions/10122289/why-does-pygame-freeze-at-pygame-event-get-when-you-move-drag-the-window – MegaIng May 16 '20 at 21:13

1 Answers1

0

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.