Skip to content

Instantly share code, notes, and snippets.

@lindemann09
Created July 1, 2014 10:54
Show Gist options
  • Save lindemann09/318855a338958d3f9a36 to your computer and use it in GitHub Desktop.
Save lindemann09/318855a338958d3f9a36 to your computer and use it in GitHub Desktop.
import pygame
from expyriment.stimuli import Canvas
class PGSurface(Canvas):
def get_surface_copy(self):
return self._get_surface().copy()
def set_surface(self, surface):
"""surface or pixel_map"""
if isinstance(surface, pygame.PixelArray):
return self._set_surface(surface.make_surface())
elif isinstance(surface, pygame.Surface):
return self._set_surface(surface)
else:
return False
def get_pixel_array(self):
return pygame.PixelArray(self.get_surface_copy())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment