Search code examples
pythonkivybuildozer

Add widgets on event . Kivy


I try to add Button on event and there is no results.This is part of code where I call 'add_picture' function.What is a problem?

UPD Build method makes gui interface by .kv file.

class TakePictureApp(App):
    def build(self):
        self.index = 0
        activity.bind(on_activity_result=self.on_activity_result)

    def on_activity_result(self, requestCode, resultCode, intent):
        if requestCode == 0x123:
            Clock.schedule_once(partial(self.add_picture, self.last_fn), 0)

In this place try to add Button(2 methods)

    def add_picture(self, fn, *args):
        self.Button.text = 'Allo'

        # return Button(text = 'Allo')

Solution

  • Your build method should return widget tree. For example I could use it in the way that my build() returns Label, and I add widgets to that Label. Your build() method looks like it doesn't return anything..