【问题标题】:How i can make multiline label in KivyMD?我如何在 KivyMD 中制作多行标签?
【发布时间】:2021-05-19 02:21:36
【问题描述】:

我想在 KV 字符串中制作多行标签:

MDLabel:
    text: '

              MultilineText'

但我收到此错误:

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

... 缩进无效,必须是 4 个空格的倍数 我不能使用三方括号,因为我的代码已经在三方括号中:

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

我想要一个标签中的多行长文本。帮助(

【问题讨论】:

    标签: python python-3.x kivy label kivymd


    【解决方案1】:

    棘手的话题。试试这个:

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

    【讨论】:

      猜你喜欢
      • 2016-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-24
      相关资源
      最近更新 更多