'How can i add a Label every time i press enter in text input in kivy?

In this program i want to add a Label every time i press enter in a Text Input.

To do that i referenced the on_text_validate to a function called enter.

But inside that function i do not know how can iter that Label with for example the text of the numbers in order.

How can i do that?

code:

import kivy
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.graphics import Color, Rectangle
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import ObjectProperty

 

Builder.load_string("""


<Box>
    t1:t1
    l1:l1
    BoxLayout:

        size: root.width,root.height
        Label:
            id:l1
            pos_hint:{'x':0,'y':0}
            size_hint: (None, None)
            height: 33
            width: 100
            text:'1'
            background_color: 6/255, 61/255, 81/255, 1
            canvas.before:
                Color:
                    rgba:self.background_color
                Rectangle:
                    size: self.size
                    pos: self.pos

        TextInput:
            id:t1
            on_text_validate:root.enter()
            cursor_color: 255/255, 143/255, 5/255, 0.8 
            pos_hint:{'x':.1,'y':0}
            multiline:False
            height: 33
            width:5000
            size_hint: (None, None)
            background_color: 0,0,0,0
            foreground_color: 255/255, 167/255, 167/255, 0.51













""")

class Box(Widget):
    t1=ObjectProperty(None)
    l1=ObjectProperty(None)
    def enter(self):
         pass
            


class foo(App):

    def build(self):
        Window.clearcolor='#1618388'
       
        return Box()







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


Sources

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

Source: Stack Overflow

Solution Source