pygame freezes when I try to exit it after running it from IDLE!
Question: I'm running it through the livewires wrapper which is just training wheels for
pygame and other python modules in general; but everytime I run it, it'll
execute and when I try to exit, it will not respond and then crash.

Any input on how I could go about fixing this would be great. There isn't any
input in my textbook and all google seems to yield are results to this problem
using pygame itself.

Apparently pygame and Tkinter seem to conflict?

Thanks in advance!

Addendum - This is the code I was trying to run:

    
    
    from livewires import games
    
    screen_w = 640
    screen_h = 480
    
    my_screen = games.Screen (wid, heit)
    my_screen.mainloop()
    


Answer: Similar question: [Pygame screen freezes when I close
it](http://stackoverflow.com/questions/5615860/pygame-screen-freezes-when-i-
close-it)

> There isn't any input in my textbook and all google seems to yield are
> results to this problem using pygame itself.

Those results probably address the same problem you're having. This is the
relevant part of the games.py file from livewires, and nowhere does it call
`pygame.quit()`:

    
    
    def handle_events (self):
        """
        If you override this method in a subclass of the Screen
        class, you can specify how to handle different kinds of
        events.  However you must handle the quit condition!
        """
        events = pygame.event.get ()
        for event in events:
            if event.type == QUIT:
                self.quit ()
            elif event.type == KEYDOWN:
                self.keypress (event.key)
            elif event.type == MOUSEBUTTONUP:
                self.mouse_up (event.pos, event.button-1)
            elif event.type == MOUSEBUTTONDOWN:
                self.mouse_down (event.pos, event.button-1)
    
    def quit (self):
        """
        Calling this method will stop the main loop from running and
        make the graphics window disappear.
        """
    
        self._exit = 1
    
    def mainloop (self, fps = 50):
        """
        Run the pygame main loop. This will animate the objects on the
        screen and call their tick methods every tick.
    
        fps -- target frame rate
        """
    
        self._exit = 0
    
        while not self._exit:
            self._wait_frame (fps)
    
            for object in self._objects:
                if not object._static:
                    object._erase ()
                    object._dirty = 1
    
            # Take a copy of the _objects list as it may get changed in place.
            for object in self._objects [:]:
                if object._tickable: object._tick ()
    
            self.tick ()
    
            if Screen.got_statics:
                for object in self._objects:
                    if not object._static:
                        for o in object.overlapping_objects ():
                            if o._static and not o._dirty:
                                o._erase ()
                                o._dirty = 1
    
            for object in self._objects:
                if object._dirty:
                    object._draw ()
                    object._dirty = 0
    
            self._update_display()
    
            self.handle_events()
    
        # Throw away any pending events.
        pygame.event.get()
    

The QUIT event just sets a flag which drops you out of the while loop in the
`mainloop` function. I'm guessing that if you find this file in your Python
directory and stick a `pygame.quit()` after the last line in `mainloop`, it
will solve your problem.

