Hello World!

The game screen appears here if your browser supports the Canvas API.

Attribution

From Making Games with Python & Pygame chapter 2.

Original Python code released under a Simplified BSD license.

Original Python code


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()