Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.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-底部和右侧位置小部件和margim_Python_Kivy_Kivy Language - Fatal编程技术网

Python Kivy-底部和右侧位置小部件和margim

Python Kivy-底部和右侧位置小部件和margim,python,kivy,kivy-language,Python,Kivy,Kivy Language,我试图将小部件放在底部和右侧位置,边距为16dp,但是我尝试了多种方式,有几种布局,但都不起作用。有人能帮我吗 ex35.py from kivy.app import App from kivy.core.window import Window Window.clearcolor = (1, 1, 1, 1) class Ex35(App): pass Ex35().run() ex35.kv FloatLayout: BoxLayout: orient

我试图将小部件放在底部和右侧位置,边距为16dp,但是我尝试了多种方式,有几种布局,但都不起作用。有人能帮我吗

ex35.py

from kivy.app import App
from kivy.core.window import Window
Window.clearcolor = (1, 1, 1, 1)

class Ex35(App):
    pass

Ex35().run()
ex35.kv

FloatLayout:
    BoxLayout:
        orientation:'vertical'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'

    Widget:
        id: ellipse
        size_hint: (None, None)
        size: (dp(56), dp(56))
        canvas:
            Color:
                rgba: 0, 1, 0, 1
            Ellipse:
                size: self.size

我用下面的代码得到它:

FloatLayout:
    BoxLayout:
        orientation:'vertical'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'
        Button:
            text:'Hello'

    Widget:
        id: ellipse
        size_hint: (None, None)
        size: (dp(56), dp(56))
        pos_hint:{'right': 1}
        canvas.before:
            Color:
                rgba: 0, 1, 0, 1
            Ellipse:
                size: self.size
                pos: [dp(self.pos[0]) - dp(16), dp(self.pos[1]) + dp(16)]

您是否尝试过
pos\u提示
?你说的16dp的利润率到底是什么意思?就像从右边到底部的16dp空间一样?Margim 16dp我通过在椭圆中添加
pos:(dp(16),dp(16))
得到它。我没有得到的是把椭圆带到底部的右边