如何去除空间之间的两BoxLayouts在码?

0

的问题

我状态,我已经读答复的其他用户到这个问题,但没有人帮我的。 我试程序计算器在蟒蛇的 码图形界面,他的问题是,我可以不删除该 空间强调了 在红在所附的照片下来这里。 我已经尝试过: size_hint: None,Nonesize:root.size[0], "5dp" 规模的BoxLayouts但是它不工作了

         [1]: https://i.stack.imgur.com/y1ZwF.png


  BoxLayoutExample:
<BoxLayoutExample>:
    orientation: "vertical"
    Label:
        text: "0"
        font_size: "30dp"
    BoxLayout:
        orientation: "horizontal"
        Button:
            text: "7"
            size_hint: .1, .3
        Button:
            text: "4"
            size_hint: .1, .3
        Button:
            text: "1"
            size_hint: .1, .3

    BoxLayout:
        orientation: "horizontal"
        Button:
            text: ","
            size_hint: .1, .3
        Button:
            text: "0"
            size_hint: .1, .3
        Button:
            text: "="
            size_hint: .1, .3
       
calculator interface kivy python
2021-11-23 20:37:05
1

最好的答案

0

你的问题是,你是 size_hint 按键相对于其父母 BoxLayout. 所以在影响你的BoxLayout的被占1/3的可用空间,(因为有三个部件 BoxLayoutExample.

这里是如何解决这个问题:

<BoxLayoutExample>:
    orientation: "vertical"

    Label:
        text: "0"
        font_size: "30dp"
        size_hint: 1, .8

    BoxLayout:
        orientation: "horizontal"
        size_hint: 1, .1
        Button:
            text: "7"
        Button:
            text: "4"
        Button:
            text: "1"

    BoxLayout:
        orientation: "horizontal"
        size_hint: 1, .1
        Button:
            text: ","
        Button:
            text: "0"
        Button:
            text: "="

调整大小 LabelBoxLayout 因此

2021-11-23 23:34:56

其他语言

此页面有其他语言版本

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................