Q:

How to remove a widget in KIVY (Labels, Buttons, etc)

I haves this code in which I want to remove a label so as to print different labels  
class Uno(Screen):

    def empezar(self):
        self.ids.grid.remove_widget(self.ids.juga)
        for i in Jugadores:
            a = Label(text=i, id="prueba")
            self.ids.grid.add_widget(a)
        self.ids.nombre.text = ""
        self.ids.borrar.disabled = True
        self.ids.reiniciar.disabled = False
        self.ids.empezar.disabled = True
        self.ids.qcartas.disabled = True
        self.ids.objetivo.disabled = True
        self.ids.agregar.disabled = True

    def reiniciar(self):
        Jugadores.clear()
        QCartas = 0
        Objetivo = 0
        self.ids.qcartas.text = ""
        self.ids.objetivo.text = ""
        self.ids.juga.text = ""
        self.ids.nombre.text = ""
        self.ids.agregar.disabled = False
        self.ids.borrar.disabled = True
        self.ids.reiniciar.disabled = True
        self.ids.empezar.disabled = True
        self.ids.qcartas.disabled = False
        self.ids.objetivo.disabled = False
        self.ids.grid.remove_widget(self.ids.juga)
        self.ids.grid.remove_widget(self.ids.prueba)
        print(Jugadores)```

kv

  BoxLayout:
            id:grid
            orientation:"horizontal"
            Label:
                id: juga
                text:""

This code works fine:
self.ids.grid.remove_widget(self.ids.juga)

But this one does not:
self.ids.grid.remove_widget(self.ids.prueba)

I gues that it is because i created the labels througth the loop. How should i do it?

A:

You should remove widget from it's parent widget, for example:
self.ids.grid.remove_widget(self.ids.juga)

