You can clone with
HTTPS or Subversion.
BoxLayout honrs size_hint, allowing, for instance, a button to be 50% the width of the container box (if orientation = vertical). But the button will always be aligned to the left, since neither pos_hint nor pos seem to have any effect.
It would make sens to apply pos_hint whenever size_hint is possible in a Layout.
(A workaround to put a Layout inside the Layout to get the same effect, but that complicates the tree unncessarily.)
I see. The dummy Widget solution only allows for absolute positioning, though, and it's not possible to center the button. I find that a very ugly solution and I prefer wrapping my button in a FloatLayout. (Which is the workaround I suggested.)
However, I would argue that BoxLayout only controls one dimension of the positioning of its children: the dimension defined by the orientation. The positioning on the other dimension is not defined in BoxLayout, and indeed arbitrary. So it would make sens to allow the user to specify the positioning only for the other dimension, by borrowing existing mechanisms of FloatLayout: pos and pos_hint.
My use case is the following:
The slider and progressbar can be 100% width, but I want the button to be smaller (50% width with size_hint), and centered.
My issue is that it seems completely arbitrary to have the widgets aligned to the left by default, and no simple way to change this hard-coded behavior.
The only solution I can find is putting a FloatLayout around the button. This is acceptable in the simple case above, but it can become ugly very fast if you have more than a few widgets you want to custom-align.
(Another option I thought about was to add the property valign or halign to the BoxLayout, but it seems less consistent with the overall design of Kivy.)
Yep, i think using pos_hint in BoxLayout for inner aligment would be ok.
Ok, doing it.
boxlayout: honoring pos_hint, only the one that make sense depending …
…the orientation. closes #698