slim-pickings
slim-pickings

Reputation: 1

Python crashing on loading pygame

I have pygame and numpy installed and both seem to be working on win10 from python shell:

import pygame

(working)

put in a script:

import pygame, sys
from pygame.locals import * 
pygame.init() 
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello World!')  
while True: # main game loop  
    for event in pygame.event.get():
        if event.type == QUIT: 
            pygame.quit() 
            sys.exit()
    pygame.display.update()

Pygame window opens and python stops. Before I exit out of python says in the python shell "no module named pygame"

Upvotes: 0

Views: 34

Answers (1)

Jeff Saltfist
Jeff Saltfist

Reputation: 943

Try to install with pip. From the command line type:

pip install pygame

Upvotes: 1

Related Questions