Home > OS >  How to paragraph of text in label Kivy and Python3?
How to paragraph of text in label Kivy and Python3?

Time:05-19

I need to make a presentation with Python3. I know the basics of Kivy and I am pretty good with Python. I just wanted know how to put lots of text in one label, for example: a whole paragraph of text. I have tried it by just putting the text in the label But this happens.

THIS

It just becomes one line along the whole window. So I wanted to make it appear in a paragraph. Also, if the code that is needed to fill my requirements in .kv file format, it will be very much appreciated. If thats not possible, its also okay in the .py file format.

I will add the code here:

.py file:

#!/usr/bin/env python3

import sys
from kivy.app import App
from kivy.metrics import dp
from kivy.properties import StringProperty
from kivy.uix.widget import Widget
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.gridlayout import GridLayout
from kivy.uix.stacklayout import StackLayout
from kivy.uix.button import Button
import kivy.resources


if getattr(sys, 'frozen', False):
    kivy.resources.resource_add_path(sys._MEIPASS)

class TaneMahuta(App):
    pass

TaneMahuta().run()

.kv file:

Box:

<Box@BoxLayout>:

        
        
    Label:
        text: "Tāne Mahuta is one of the six kids that were born to Papatūānuku and Ranginui. Tāne is an vital character in the Māori culture because his job is to maintain the greenery and life on the earth. The forests he looks after are essential sources of food, places to live, and much more. He is the god of most natural creatures. In stories, he is very confident, persistent and resilient. He is also the one that separated Ranginui and Papatūānuku to let in light. Even the largest tree in NZ is named after him = Tāne Mahuta. The tree, Tāne Mahuta, has some of the attributes of Tāne Mahuta (atua). It is a symbol of strength and stature. "

Thank you very much in advance!

Keep coding,

Maheswar

CodePudding user response:

text_size should work

.kv

Box:    
    <Box@BoxLayout>:
        Label:
            text: "Tāne Mahuta is one of the six kids that were born to Papatūānuku and Ranginui. Tāne is an vital character in the Māori culture because his job is to maintain the greenery and life on the earth. The forests he looks after are essential sources of food, places to live, and much more. He is the god of most natural creatures. In stories, he is very confident, persistent and resilient. He is also the one that separated Ranginui and Papatūānuku to let in light. Even the largest tree in NZ is named after him = Tāne Mahuta. The tree, Tāne Mahuta, has some of the attributes of Tāne Mahuta (atua). It is a symbol of strength and stature. "
            text_size: 100, None

hope this help.

  • Related