Commits

Brendan Howell  committed 6388406

Fixes #9

  • Participants
  • Parent commits cce2f72

Comments (0)

Files changed (2)

 import pygame
 import os
 import platform
+import sys
 
 class Store:
     def __init__(self):
         self.screen = pygame.display.set_mode((x,y), flags, 32)
         pygame.display.set_caption('PyCessing - ' + self.filename, "PyCessing")
         module_location = os.path.dirname(__file__)
-	
+
         plat = platform.system()
-	if plat == "Linux":
+        if plat == "Linux":
             icon = pygame.image.load(os.path.join(module_location,"icons", "app-icon.ico"))
         else:
             icon = pygame.image.load(os.path.join(module_location,"icons", "app-icon.icns"))
     def doEvents(self, eventlist):
         for event in eventlist:
             try:
-                if event.type == pygame.KEYDOWN:
+                if event.type == pygame.QUIT:
+                    sys.exit(0)
+                elif event.type == pygame.KEYDOWN:
                     self._numKeysPressed += 1
                     self.keyPressed = True
                     self.key = event.unicode
     pygame.display.flip()
     if(pycessing.noLoop):
         while 1:
-            pygame.event.get()
+            events = pygame.event.get()
+            for event in events:
+                if event.type == pygame.QUIT:
+                    sys.exit(0)
             pycessing.clock.tick(30)