'Why can't I delete a button with widget in Kivy

So I'm trying to make a button delete himself after pressed with widgets, and I tried many ways that all end up as a fail...

Here's the .Kv Code:

Spinner:
            id: spinner_agua
            text: "Tempo"
            values: ["15 EM 15 SEGUNDOS", "30 EM 30 MINUTOS", "1 EM 1 HORA", "2 EM 2 HORAS"]
            pos_hint: {"center_x": .5, "center_y": .9}
            on_text:
                root.cancel_button()
                if spinner_agua.text == "30 EM 30 MINUTOS": root.agua_spinner(spinner_agua.text)
                if spinner_agua.text == "15 EM 15 SEGUNDOS": root.agua_spinner(spinner_agua.text)

Here's Python Code:

def cancel_button(self):
    self.cnl_btn = MDApp.get_running_app().root.get_screen('auto_lemb')
    self.cnl_btn.ids.FLay.add_widget(MDFillRoundFlatButton(text = "CANCELAR",
        pos_hint = {'center_x': .67, 'center_y': .71},
        md_bg_color = (1, 0, 0, 1),
        on_release = self.teste))

def teste(self, *args):
    self.remove_widget(self.cnl_btn)
    Clock.schedule_once(self.stop_interval, 5)

Note: Its not the intire code here, my intire code will be posted if asked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source