TheAmazingKitchen
TheAmazingKitchen

Reputation: 123

"Fatal Python error: (pygame parachute) Segmentation Fault" when changing window

I'm currently learning python and tried to make a little game using the pygame librabry. I use python 3.2.3 and pygame 1.9.2a with Windows Xp. Everything works fine, except one thing : if I go on another window when my game is running, it crashes and I get an error message in the console :

Fatal Python error: (pygame parachute) Segmentation Fault

This piece of code that I took out of my program seems to be causing the error, however I can't see anything wrong with it :

import pygame
from pygame.locals import *

pygame.init()

fenetre = pygame.display.set_mode((800, 600))

go = 1

while go:
    for event in pygame.event.get():
        if event.type == QUIT:
            go = 0

Thanks for your help !

Upvotes: 2

Views: 5230

Answers (2)

user1389840
user1389840

Reputation: 679

I know thread is old, but I was getting the same error "Fatal Python error: (pygame parachute) Segmentation Fault" in linux when I resized a pygame window continuously for several seconds. Just in case this helps anyone else, it turned out to be caused by blitting to the window surface in one thread when I was resizing it in another thread by calling pygame.display.set_mode(screen_size, 0). I fixed it by acquiring a lock before drawing to or resizing the window.

Upvotes: 4

ThisIsAQuestion
ThisIsAQuestion

Reputation: 1967

I don't know if you have anything after the last line that you're not putting in, but if you don't, you should replace your last line with

pygame.quit()
sys.exit()

As an alternative, you could put those two lines outside of the while loop and keep what you have. Don't forget to import sys.

Upvotes: 0

Related Questions