Created
July 1, 2014 10:54
-
-
Save lindemann09/318855a338958d3f9a36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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