Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Kivy RstDocument center将其所有内容对齐_Python_Kivy_Restructuredtext - Fatal编程技术网

Python Kivy RstDocument center将其所有内容对齐

Python Kivy RstDocument center将其所有内容对齐,python,kivy,restructuredtext,Python,Kivy,Restructuredtext,我使用的是kivy的(2.0.0.rc3)RST文档,出于某种原因,它将所有内容对齐。如果我将文本设置为“hello”,它将居中(水平)。A正常段落所有文本均居中对齐。在表格中,所有单元格都居中(尽管这可能是正常的)。A::阻止所有文本也居中,但它使用单空格字体,以便识别:: <Container>: id: container orientation: 'horizontal' padding: '3sp' canvas: Color

我使用的是kivy的(2.0.0.rc3)RST文档,出于某种原因,它将所有内容对齐。如果我将文本设置为“hello”,它将居中(水平)。A正常段落所有文本均居中对齐。在表格中,所有单元格都居中(尽管这可能是正常的)。A::阻止所有文本也居中,但它使用单空格字体,以便识别::

<Container>:
    id: container
    orientation: 'horizontal'
    padding: '3sp'
    canvas:
        Color:
            hsv: (330/360, 1, 0.1)
        Rectangle:
            size: self.size
            pos: self.pos

    # other components left out

    Popup:
        id: popup
        on_parent: if self.parent == container: container.remove_widget(self)
        auto_dismiss: True
        RstDocument:
            id: rst
            text: 'hello\n\nthere' 
:
id:集装箱
方向:“水平”
填充:“3sp”
画布:
颜色:
高速列车:(330/360,1,0.1)
矩形:
大小:self.size
pos:self.pos
#其他遗漏部分
弹出窗口:
id:弹出窗口
在\u父项上:如果self.parent==container:container.remove\u小部件(self)
自动排除:正确
RST文件:
id:rst
文本:“您好\n\n此处”

Python代码只需调用弹出窗口的open(),不做任何更改。知道为什么会这样吗?提前谢谢你的指点。

我解决了这个问题。我有这个

<Label>:
    # some properties I want all labels to have
    halign: 'center'
:
#我希望所有标签都具有某些属性
哈利恩:“中心”

哦!这段看起来无害的代码把一切都搞糟了

Popup
基类是
AnchorLayout
(默认情况下将其内容居中),因此您可以将
anchor\u x
和/或
anchor\u y
添加到
Popup
规则中以调整该行为。谢谢。我试过了,但没用。我想可能是因为我把它放在一个弹出窗口里,然后把它拉出来,放在一个不同的容器里,但结果是一样的。古怪的kivy catalog示例似乎没有做任何不同的事情,但它很好。