From 4bf8ea321598623fcf17289dce11f50f0e4afb3d Mon Sep 17 00:00:00 2001
From: Billionaire'S Code <nishant7528@gmail.com>
Date: Fri, 2 Oct 2020 12:17:36 +0530
Subject: [PATCH] Update pygame template.py

in some machines , only doing running == false might give error so it is better to do sys.exit() along with pygame.quit()
---
 pygame template.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/pygame template.py b/pygame template.py
index 82156ca..93ffd31 100644
--- a/pygame template.py	
+++ b/pygame template.py	
@@ -1,6 +1,7 @@
 # Pygame template - skeleton for a new pygame project
 import pygame
 import random
+import sys
 
 WIDTH = 360
 HEIGHT = 480
@@ -17,20 +18,21 @@
 pygame.init()
 pygame.mixer.init()
 screen = pygame.display.set_mode((WIDTH, HEIGHT))
-pygame.display.set_caption("My Game")
+pygame.display.set_caption("The Game")
 clock = pygame.time.Clock()
 
 all_sprites = pygame.sprite.Group()
 # Game loop
-running = True
-while running:
+while True:
     # keep loop running at the right speed
     clock.tick(FPS)
     # Process input (events)
     for event in pygame.event.get():
         # check for closing window
         if event.type == pygame.QUIT:
-            running = False
+            pygame.quit()
+            sys.exit()
+            
 
     # Update
     all_sprites.update()
@@ -39,6 +41,5 @@
     screen.fill(BLACK)
     all_sprites.draw(screen)
     # *after* drawing everything, flip the display
-    pygame.display.flip()
+    pygame.display.update()
 
-pygame.quit()