Pygame how to install code example
Example 1: how to setup pygame
import pygame
import sys
pygame.init()
clock = pygame.time.Clock()
FPS = 30
screen_width = 600
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
while True:
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
Example 2: install pygame on mac
python3 -m pip install -U pygame==2.0.0.dev6
Example 3: pygame install
pip install pygame
Example 4: how to set up pygame
import pygame
import os
import sys
import random
pygame.init()
screen = pygame.display.set_mode((800, 500))