A.Piquer
A.Piquer

Reputation: 424

Break Line in a Kivy Label doesn't work (Python)

I'm trying to add a Label to python through the kivy app module and the break line doesn't work. I don't know why, because I've read that actually had to run perfectly. The text in kv language is:

 Label:
        text: 'hola hola hola hola hola\nhola hola hola hola holhola hola hola hola holhola hola\n hola hola hol\nhola hola hola hola hol'
        size_hint: 0.2, 0.05
        pos_hint: {'center_x':0.5,'center_y':0.45}

I think all the lines aren't necessary, because the term of size_hint don't modify the size of the label, but without this line the issue is the same. Thank you all.

Upvotes: 3

Views: 5652

Answers (1)

Peter Badida
Peter Badida

Reputation: 12169

In kivy language you have to use escape to that \n symbol, because it's all in a big string that is then used to create widgets and other important stuff.

Example:

Label:
        text: 'hola hola hola\\nhola hola hola h'
        size_hint: 0.2, 0.05
        pos_hint: {'center_x':0.5,'center_y':0.45}

Upvotes: 9

Related Questions