question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BoxLayout size_hint_x ignored

See original GitHub issue

The second button fills the available space, it will also do the same when it is the only children. Other layouts behave as expected in this case, they fill the space according to the size_hint value.

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout

kv = """
<Test>:
    Button:
        size_hint_x: None
        width: dp(80)
    Button:
        size_hint_x: 0.5
"""

Builder.load_string(kv)


class Test(BoxLayout):
    pass


class TestApp(App):
    def build(self):
        return Test()

if __name__ == '__main__':
    TestApp().run()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
dessantcommented, Mar 25, 2016

@werton, i’ve wrongly assumed things and i’ll bear the consequences until my last breath 😉, thanks for standing up, it’s important to challenge each other’s assumptions.

0reactions
wertoncommented, Mar 25, 2016

Hooray, I don’t have to write their own implementation of the BoxLayout. thanks for the discussion 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kivy BoxLayout size_hint not working? - Stack Overflow
it streches to full x axis width. It stretches to full x axis only if Button is single element inside BoxLayout : it...
Read more >
Size hint is not honored if set to zero · Issue #7281 · kivy/kivy
The size_hint seems to not be honored/used if it is set to 0. Only if it is the second widget inside its parent....
Read more >
Solving Common Layout Problems (The Java™ Tutorials ...
The BoxLayout manager generally uses a component's preferred size (although components can be larger), and is one of the few layout managers that...
Read more >
JScrollPane causes BoxLayout to ignore maximum sizes
I have a JPanel with BoxLayout with a lot of JTextPanes inside of it. The text panes have a preferred size of (600,...
Read more >
Ignored class re-declaration : r/kivy - Reddit
Hello everyone, I'm currently trying to write an app that updates a list property from a back-end and shows it inside a spinner....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found