Skip to content

Instantly share code, notes, and snippets.

@topherPedersen
Created October 18, 2018 23:48
Show Gist options
  • Select an option

  • Save topherPedersen/7ebb938fa583d11f6ed623ce3e6b6faf to your computer and use it in GitHub Desktop.

Select an option

Save topherPedersen/7ebb938fa583d11f6ed623ce3e6b6faf to your computer and use it in GitHub Desktop.
pygame "hello, world" example
# https://nerdparadise.com/programming/pygame/part1
import pygame
pygame.init()
screen = pygame.display.set_mode((400, 300))
# Add this somewhere after the event pumping and before the display.flip()
pygame.draw.rect(screen, (0, 128, 255), pygame.Rect(30, 30, 60, 60))
done = False
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
pygame.display.flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment