Skip to content

Instantly share code, notes, and snippets.

@snim2
Created November 29, 2009 01:11
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save snim2/244729 to your computer and use it in GitHub Desktop.
Use a python-csp process to render images to Pygame
@process
def Drawme(channel, _process=None):
import pygame
# Constants
WIDTH, HEIGHT = 512, 256
# Open window
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), 0)
QUIT = False
while not QUIT:
data = channel.read()
# Drawing code goes here...
for event in pygame.event.get():
if event.type == pygame.QUIT:
QUIT = True
# Process other events here ...
channel.poison()
pygame.display.quit()
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment