Q:

How to position Label Widgets inside the BoxLayout correctly

I had this python code with kv which has a ScrollView widget that enables me to scroll horizontally and vertically.
from kivy.app import App
from kivy.lang import Builder

main_kv = """

ScrollView:

    BoxLayout:
        orientation: "vertical"
        size_hint: (None, None)
        width: self.minimum_width
        height: self.minimum_height

        Label:
            text: "A veryyyyyyyyyyyyyyyyyyyyy long text."
            font_size: sp(30)
            size_hint: (None, None)
            height: dp(30)
            width: self.texture_size[0]

"""

class TestApp(App):

    def build(self):
        return Builder.load_string(main_kv)

TestApp().run()

The above code works... but my goal is to add a button that when pressed, the BoxLayout widget will add a new Label widget.. 
I tried to modify the code with this but:
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.metrics import dp, sp
from kivy.uix.boxlayout import BoxLayout

main_kv = """

<Main>:

    ScrollView:

        BoxLayout:
            id: boxlayout_id
            orientation: "vertical"
            size_hint: (None, None)
            width: self.minimum_width
            height: self.minimum_height

            Label:
                text: "A veryyyyyyyyyyyyyyyyyyyyy long text."
                font_size: sp(30)
                size_hint: (None, None)
                height: dp(30)
                width: self.texture_size[0]

    Button:
        text: "Add Label"
        on_press: root.add_newlabel()          
"""

class Main(BoxLayout):
    def __init__(self):
        super(Main, self).__init__()

        self.orientation = "vertical"

    def add_newlabel(self, *args):
        newLabel = Label()
        newLabel.text = " A veryyyyyyyyyyyyyyyyyyyyy long text."
        newLabel.font_size = sp(30)
        newLabel.size_hint = (None, None)
        newLabel.height = dp(30)
        newLabel.width = newLabel.texture_size[0]

        self.ids.boxlayout_id.add_widget(newLabel)

class TestApp(App):

    def build(self):       
        Builder.load_string(main_kv)      
        return Main()               

TestApp().run()

The problem of the modified code is that the newLabel widgets' position is odd.
Let's look at this image.
The image below is the output (not yet clicking the Button).

It's normal and okay. 
The image below is the output after I clicked the Button widget thrice.

As we can see, the three newLabel widgets' x position is sligthly off.
I tried to analyze what was the cause of this problem but I can't figure it out. 
I will appreciate any kind of help.

A:

Instead of creating a new Label and adding the properties each time you add, you can create a template and add it.
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout

main_kv = """
<CustomLabel>:
    font_size: sp(30)
    size_hint: (None, None)
    multiline:True
    size: self.texture_size

<Main>:
    scroll_view: sv
    boxlayout: boxlayout_id
    ScrollView:
        id: sv
        BoxLayout:
            id: boxlayout_id
            orientation: "vertical"
            height: self.minimum_height
            size_hint: (None, None)

    Button:
        text: "Add Label"
        on_press: root.add_newlabel()          
"""

class CustomLabel(Label):
    pass

class Main(BoxLayout):
    def __init__(self):
        super(Main, self).__init__()
        self.orientation = "vertical"
    def add_newlabel(self, *args):
        newLabel = CustomLabel()
        newLabel.text = " A veryyyyyyyyyyyyyyyyyyyyy long text."
        self.boxlayout.add_widget(newLabel)
        self.scroll_view.scroll_to(newLabel)

class TestApp(App):
    def build(self):       
        Builder.load_string(main_kv)      
        return Main()               

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

