Grimmys / rpg_tactical_fantasy_game

A tactical turn-based game project in pygame, open to support
GNU General Public License v3.0
392 stars 85 forks source link

Make sure the window doesn't hang around in IDLE #50

Closed Starbuck5 closed 2 years ago

Starbuck5 commented 2 years ago

I added in a pygame.quit() so the window closes when the program execution ends on IDLE.

I also got rid of the raise SystemExit, because I don't believe it's needed, as the program execution stops right after it.

Grimmys commented 2 years ago

Yes, I think I decided a while ago to keep this raise SystemExit statement even if it was useless for "documentation purpose", but don't think it was a meaningful decision back now.

I'm more skeptical about the pygame.quit() addition though, it was present before but I removed it because it seems to be unnecessary... I checked it today again and according to docs it is implicitly call anyway:

https://www.pygame.org/docs/ref/pygame.html#pygame.quit "[...] When the Python interpreter shuts down, this method is called regardless, so your program should not need it, except when it wants to terminate its pygame resources and continue."

I also tested it, and I'm not able to see any difference between having this line or not.

Am I missing something @Starbuck5 ?

Starbuck5 commented 2 years ago

It’s specifically for IDLE @Grimmys

IDLE doesn’t shut down the python environment when a script ends.

Grimmys commented 2 years ago

Oooooh ok, sorry at first I thought by IDLE you mean the word: https://dictionary.cambridge.org/fr/dictionnaire/anglais/idle But yeah you will not have put in in caps if it was the case.

Thanks for your contribution then!