diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 16b22a8..1326bad 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -41,8 +41,8 @@ - - + + @@ -493,8 +493,8 @@ - - + + diff --git a/lib/graphiclib.py b/lib/graphiclib.py index 838550b..0882056 100644 --- a/lib/graphiclib.py +++ b/lib/graphiclib.py @@ -74,6 +74,7 @@ class PiCamera(pygame.sprite.Sprite): pygame.camera.init() camera = picamera.PiCamera() self.camera = camera + self.output = picamera.array.PiRGBArray(camera, size=size) self.size = size self.image = pygame.Surface(self.size) self.image.fill((0, 0, 0)) @@ -82,7 +83,7 @@ class PiCamera(pygame.sprite.Sprite): def update(self, *args): print('updating camera') - with picamera.array.PiRGBArray(self.camera, size=self.size) as output: - self.camera.capture(output, 'rgb') - s = pygame.transform.rotate(pygame.surfarray.make_surface(output.array), 90) - self.image.blit(s, (0, 0)) \ No newline at end of file + self.output.truncate(0) + self.camera.capture(self.output, 'rgb') + s = pygame.transform.rotate(pygame.surfarray.make_surface(self.output.array), 90) + self.image.blit(s, (0, 0)) \ No newline at end of file