Split string into different labels
Question: I'm trying to split a string into words and then putting each word on a
different label. I found here a code that can split and print each word:

    
    
    my_phrase="The split method returns a list of the words in the string"
    my_split_words = my_phrase.split() 
    for each_word in my_split_words:
       print each_word
    

But how to make a loop for instead of printing, generating labels?

I'm using Python 2.7 with Kivy for the GUI. Thanks in advance!

Sorry if my formatting is wrong, first post here :)

**Edit 1:**

My code looks like this right now:

    
    
    from kivy.app import App
    
    from kivy.uix.scatter import Scatter
    from kivy.uix.label import Label
    from kivy.uix.floatlayout import FloatLayout
    from kivy.uix.boxlayout import BoxLayout
    
    class TestApp(App):
        def build(self):
            b = BoxLayout(orientation='vertical')
            f = FloatLayout()
            s = Scatter()
            l = [Label(text=word) for word in "The split method returns a list of the words in the string".split()]
    
            f.add_widget(s)
            s.add_widget(l)
            b.add_widget(f)
            return b
    
    if __name__ == "__main__":
        TestApp().run()
    

After @Hugh Bothwell answer I tried to replace the old L label for the
multiple labels generated on the split, but it didn't work :T

**Edit2:** Now my code is working fine, thanks everyone. It takes the input
from the user, then split the string into scatter labels. It is a little
messy, but it will do the job!

    
    
    class TestApp(App):
        def build(self):
            ti = TextInput(font_size=30,
                          size_hint_y=None,
                          height=50,
                          text='default')
            b = BoxLayout(orientation='vertical')
            f = FloatLayout()
    
            def SplitIntoLabels(*args):
                f.clear_widgets()
                for word in new_list:
                    s = Scatter(size_hint_x=None, size_hint_y=None, do_rotation=False)
                    l = Label(text=word, font_size=50)
                    s.add_widget(l)
                    f.add_widget(s)
                    s.size=l.size
    
            ti.bind(text=SplitIntoLabels)
    
            b.add_widget(ti)
            b.add_widget(f)
    
            return b
    
    if __name__ == "__main__":
        TestApp().run()
    


Answer: 
    from kivy.uix.label import Label
    
    my_phrase = "The split method returns a list of the words in the string"
    
    labels = [Label(text=word) for word in my_phrase.split()]
    

**Edit:**

    
    
    for lab in labels:
        s.add_widget(lab)
    

or, more directly,

    
    
    for word in my_phrase.split():
        s.add_widget(Label(text=word))
    

