Camera uix not binding texture when initialized with play=False

16 views
Skip to first unread message

Andrew McLeod

unread,
Jan 16, 2019, 11:37:00 AM1/16/19
to Kivy users support
I've been playing with the Kivy android support and I've noticed a probable bug (but I don't have time to write a minimal example etc to make a Github issue; just in case anyone fancies a probably easy enough fix).

When you create a new Camera (the kivy.uix one, not the kivy.core one) you can pass the argument play=False to it (the default is play=True). According to the documentation, this will create the new camera 'stopped'. Which is all well and good, except that:

__init__ sets
on_index = self._on_index

and later calls it. Then in self._on_index, you have:
if self.play: self._camera.start() self._camera.bind(on_texture=self.on_tex)
so if self.play = False at the start, then (unless you change the camera index, which I suspect is rare) you never bind the texture and the camera doesn't work. The on_play calls just call self._camera.start() or self._camera.stop(); they don't bind the texture. I have bodged it in my app with:

def _on_index(self, *largs):
    super()._on_index(*largs)
    if self._camera and not self.play:
        self._camera.bind(on_texture=self.on_tex)

but that's pretty ugly.
Reply all
Reply to author
Forward
0 new messages