Issue #329 new

Python 3 Pygame scripts won't quit

ocket8888
created an issue

Just like the title says, I've never been able to write a pygame script that will exit properly. Even something as simple as

#!/usr/bin/env python3

import pygame
from sys import exit as sysExit

pygame.init()
screen = pygame.display.set_mode((512,512))
screen.fill((255,255,255))

pygame.display.update()

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.display.update()
            pygame.display.quit()
            pygame.quit()
            exit(0)
            sysExit(0)
            #None of these work, code under them is unreachable but the process hangs

hangs. More information is available here

Comments (3)

  1. ocket8888 reporter

    After hanging out in the irc, user DR0ID_ helped me figure out that this issue is caused specifically by the pygame.mixer module, and he thinks it's probably caused by the fact that I'm on a virtual machine which could be causing driver issues.

  2. ocket8888 reporter

    I have confirmed that the 64-bit Linux VM on my desktop will exit the same script just fine, so the architecture could be related to the issue; the VM with the problem is 32-bit. There aren't any significant differences in the OS's themselves, same version of VirtualBox, same versions of pygame and python3.

  3. Log in to comment