简体   繁体   中英

How do I create multiline texts in kivyMD

I am trying to create a simple app with multiline text, but I keep getting a 'Invalid indentation (too many levels)'. Here is my main.py file;

from kivymd.app import MDApp


class TwoScreenApp(MDApp):
    def build(self):
        return


TwoScreenApp().run()

And here is my .kv file. I would appreciate any sort of help, Thanks.

MDScreen:
    md_bg_color: (255/255, 255/255, 255/255, 1)

MDLabel:
    halign: 'center'
    text: """With the production of the Model T automobile,
            \nHenry Ford had an unforeseen and tremendous
            \nimpact on American life. He became regarded
            \nas an apt symbol of the transition from an
            \nagricultural to an industrial America.
        """

This will work:

MDLabel:
    halign: 'center'
    text:
        """With the production of the Model T automobile,
        Henry Ford had an unforeseen and tremendous
        impact on American life. He became regarded
        as an apt symbol of the transition from an
        agricultural to an industrial America."""

For some reason, putting the multiline literal starting on a separate line makes it work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM