Mirai
Mirai

Reputation: 135

How i can make multiline label in KivyMD?

I want make multiline label in KV string:

MDLabel:
    text: '

              MultilineText'

But i receive this error:

 text: '
       8:                     
 >>    9:                     MultilineText'
      10:                     
      11:            pos_hint: {'center_x':.5,'center_y':.5}

... Invalid indentation, must be a multiple of 4 spaces Use triple bracket i can't, because my code already in triple bracket:

'''
<Code>
    size_hint_y: None
    height: 60
    FloatLayout:
        MDLabel:
            text: '
                     
                     MultilineText'
                     
            pos_hint: {'center_x':.5,'center_y':.5}
'''

I want multiline long text in one label. help(

Upvotes: 1

Views: 1521

Answers (2)

Olivier Ipa
Olivier Ipa

Reputation: 49

I tried it out and it worked nicely!

        MDLabel:
            markup : True
            multiline : True
            font_size :'12sp'
            text: '[b][color=#007acc] Derived Cust Bullet Rates (%) [/color][/b]'+'\\n' +\' Rate convention linked'
            pos_hint: {'center_x': 1,'center_y': 0.75}

Upvotes: -1

John Anderson
John Anderson

Reputation: 39082

Tricky topic. Try this:

'''
<Code>
    size_hint_y: None
    height: 60
    FloatLayout:
        MDLabel:
            text: '\\n' +\
                  '\\n' +\
                  'MultilineText'
                     
            pos_hint: {'center_x':.5,'center_y':.5}
'''

Upvotes: 3

Related Questions