Answers for "pygame package in python"

7

install pygame

python3 -m pip install pygame <<<(mac)>>>
or
python -m pip install pygame <<<(windows)>>>
or
sudo apt install python3-pygame <<<(ubuntu)>>>
Posted by: Guest on September-22-2020
5

pygame python

# Pygame boiler plate
# Should have a red square on screen if run
# pip3 install pygame

import pygame

screen = pygame.display.set_mode((1280, 720))

running = True
while running:
	screen.fill((0, 0, 0))
  
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			running = False

	pygame.draw.rect(screen, (255, 0, 0), ((10, 10), (50, 50)))
            
	pygame.display.update()
    
pygame.quit()
Posted by: Guest on June-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language