Radomir Dopieralski avatar Radomir Dopieralski committed ac14e12

Fix closing the window

Comments (0)

Files changed (3)

                 except util.QuitLevel:
                     pass
         except util.QuitGame:
+            pygame.quit()
             return
 
     def game_menu(self):
         choice = None
         try:
             while choice is None:
-                self.clock.tick(15)
                 self.display.update()
                 self.display.draw()
+                self.clock.tick(15)
                 choice = menu.update()
         except util.QuitLevel:
             raise util.QuitGame()
Add a comment to this file

jelly/jelly.png

Old
Old image
New
New image
     def move(self, di):
         self.cursor.item = max(0, min(len(self.items)-1, self.cursor.item + di))
 
-    def cleanup(self):
+    def cleanup(self, wait=True):
         for sprite in self.sprites:
             sprite.kill()
-        while True:
+        while wait:
             if pygame.event.wait().type == pg.KEYUP:
                 return
 
                 self.cleanup()
                 return False
             elif event.type == pg.QUIT:
-                self.cleanup()
+                self.cleanup(False)
                 raise util.QuitGame()
             elif event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE:
                 self.cleanup()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.