From 57808f435718a1948da32e7d7c1f25d241c15186 Mon Sep 17 00:00:00 2001 From: Waldo Bronchart Date: Thu, 30 Aug 2012 23:50:12 +0200 Subject: [PATCH] Fixed bug with Camera widget in .kv file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The resolution property is not initialized before _on_index() is called. So the app crashes because [-1, -1] is not a supported resolution. ... Camera:     resolution: (640, 480)     index: 0 --- kivy/uix/camera.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kivy/uix/camera.py b/kivy/uix/camera.py index 81eb5dfb9..c707a9cf1 100644 --- a/kivy/uix/camera.py +++ b/kivy/uix/camera.py @@ -96,6 +96,8 @@ class Camera(Image): self._camera = None if self.index < 0: return + if self.resolution[0] < 0 or self.resolution[1] < 0: + return self._camera = CoreCamera(index=self.index, resolution=self.resolution, stopped=True) self._camera.bind(on_load=self._camera_loaded)