1

on my mac I ran pygame and never got it working and I've done my research and found no conclusion.

The code I used to bring up some sort of screen...

import pygame
from pygame.locals import *

pygame.init()

win = pygame.display.set_mode((400,400))
pygame.display.set_caption("My first game")
clock = pygame.time.Clock()

run = True
while run:

    # handle events
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
             run = False

    # update game objects
    # [...]

# clear display
win.fill((0, 0, 0))

# draw game objects
# [...]

# update display
pygame.display.flip()

# limit frames per second
clock.tick(60) 

pygame.quit()

The python launcher logo jumps up and down for a second and comes up with python quit unexepctedly

Process:               Python [4082]
Path:                  /Library/Frameworks   
/Python.framework/Versions/3.9/Resources/Python.app
/Contents/MacOS/Python
Identifier:            org.python.python
Version:               3.9.5 (3.9.5)
Code Type:             X86-64 (Native)
Parent Process:        Python [4040]
Responsible:           Python [4082]
User ID:               505

Any help on how I can get pygame to work? Or how to get any screen at all?

btw i installed pygame with pip3 and pip

1 Answers1

0

You aren't telling pygame to run any events, and so the window just closes and the program stops.

Quantalabs
  • 379
  • 2
  • 14