您可以将行换成猕猴桃文件吗? [英] Can you wrap lines in a kivy file?

查看:54
本文介绍了您可以将行换成猕猴桃文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的kv中有几行内容.文件真的很长(超过80个字符),我想知道是否有一种方法可以在下一行将它们包装/继续.

I have a couple of lines in my kv. file that are really long (80+ chars), and I was wondering if there was a way to wrap/continue them on the next line.

例如,我该怎么做

Line:
    points: self.pos[0] + 5, self.pos[1] + 2, self.pos[0] + self.width - 5, self.pos[1] + 2

Line:
    points: self.pos[0] + 5, self.pos[1] + 2, 
            self.pos[0] + self.width - 5, self.pos[1] + 2

或类似的东西.

推荐答案

根据

Acording to https://kivy.org/docs/api-kivy.lang.html#valid-expressons, you can use line continuation character (\):

Line:
    points:
        self.pos[0] + 5, self.pos[1] + 2,\ 
        self.pos[0] + self.width - 5, self.pos[1] + 2

新行不应添加缩进级别.请注意,以下语法无效:

New line shouldn’t add an indentation level. Note that the following syntax is invalid:

Line:
    points: self.pos[0] + 5, self.pos[1] + 2,\ 
            self.pos[0] + self.width - 5, self.pos[1] + 2

另一个有效示例:

canvas:
    Rectangle:
        pos:
            self.center_x-5,\
            0
        size:
            10,\
            self.height 

这篇关于您可以将行换成猕猴桃文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆