I state that I have already read the answers of other users to this question but none of them helped me. I'm trying to program a calculator in python with the kivy GUI interface,he problem is that i can't remove that space highlighted in red in the attached photo down here. I have already tried with: size_hint: None,None
and size:root.size[0], "5dp"
to scale the BoxLayouts but it doesn't worked
[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
CodePudding user response:
Your problem is that you are setting size_hint
of the Buttons relative to its parent BoxLayout
. So in effect your BoxLayout's are taking up 1/3 of the available space (because there are three widgets in BoxLayoutExample
.
Here is how to fix it:
<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: "="
Adjust the size of the Label
and the BoxLayout
accordingly