Title: How to retrieve variable from Spinner to use it in RecycleView?
Tags: python,class,variables,android-recyclerview,kivy

Question: I'm a kivy beginner and i cant retrieve this damn spinner variable. I'm a bit confused with the different ways python and kivy handle variables. Here is my (shorten) code:
from kivy.app import App
from kivy.properties import ObjectProperty, StringProperty, ListProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.lang import Builder
from kivy.uix.recycleview import RecycleView
from kivy.uix.recycleview.views import RecycleDataViewBehavior
from kivy.uix.widget import Widget
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.lang import Builder

Builder.load("""
#<MyViewClass>:
#    orientation: 'vertical'
#    label_vc: 'type'


<MyRecycleView>:
    id: rv
    viewclass: 'Label'
    RecycleBoxLayout:
        default_size: None, dp(56)
        default_size_hint: 1, None
        size_hint_y: None
        height: self.minimum_height
        orientation: 'vertical'

<MyLayout>:
    label_current: "type"
    BoxLayout:
        orientation: 'vertical'
        size: root.width, root.height

        Button:
            text: 'Ajouter/Supprimer/Modifier'
            size_hint: 1, .1
            on_release: root.ajoutSuppMod()

        Spinner:
            size_hint: 1, .1
            id: spinner_id
            text: "Type"
            values: ["ACCOMPAGNEMENT", "AROMATIQUE", "DESSERT", "PLAT", "VIANDE", "POISSON", "SAUCE", "SOUPE"]
            on_text: label_current = root.on_spinner_select(self.text)
            on_text: root.spinner_clicked(spinner_id.text)
            on_text: root.changeImage()

        Label:
            id: click_label
            text: "CONGELO Liste"
            font_size: 32
            size_hint: 1, .2

        MyImage:
            id: img
            source: root.cheminImage

        MyRecycleView:
"""


def freezer(type_aliment):
    dict_freez = {"accompagnement": [1, 2], "aromatique": [3, 4], "dessert": [1, 2], "soupe": [5, 2]],
                    "plat": [1, 2], "poisson": [1, 2], "sauce": [1, 2], "viande": [1, 2],
                    "divers": [1, 2]}    
    return dict_freez[type_aliment]


class MyImage(Image):
    pass


class MyLayout(Widget):
    cheminImage = StringProperty('assets/32/type.png')
    value = StringProperty('viande')


    def on_spinner_select(self, text):
        return text

    def changeImage(self):
        img = 'assets/32/' + self.ids.click_label.text + ".png"
        self.cheminImage = img


class MyViewClass(RecycleDataViewBehavior, BoxLayout):
    text = StringProperty("")
    index = None

    def refresh_view_attrs(self, rv, index, data):
        self.index = index
        return super(MyViewClass, self).refresh_view_attrs(rv, index, data)


class MyRecycleView(RecycleView):
    rvtest = StringProperty('type')

    def __init__(self, **kwargs):
        super(MyRecycleView, self).__init__(**kwargs)
        self.data = [{'text': str(x)} for x in freezer(MY_DAMNED_VARIABLE!!)]
        

class SpinApp(App):
    def build(self):
        Window.clearcolor = (0, 0, 0, 1)
        return MyLayout()


if __name__ == '__main__':
    SpinApp().run()

Thanks in advance !
The recyclerview displays the correct things (1 then 2) if I put directly a string (like "poisson") :
self.data = [{'text': str(x)} for x in freezer("poisson")]
But it displays noting whatever the variable I tried to insert to represent my spinner text.

Answer: Finally I found the solution thanks to a better understanding of variable references.
A YT video explains this very clearly : Data handling, widget referencing