You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GUI AnchorLayout broken when using ScrollArea #2818
While trying to right align and left aligned different elements in a scroll area the UIAnchorLayout caused all of the UI to disappear. To test I made this small minimal snippet, and discovered that mixing UIBoxLayout and UIAnchorLayout led to the UIAnchorLayout children to draw over the UIBoxLayout.
Within the code Layouts are given a size, but the size_hint is not set to None, which means the defaults apply and the sizes are overwritten.
UIBoxLayouts have default: size_hint=(0,0) and calculate size_hint_minbased on children. UIAnchorLayout have defaultsize_hint=(1,1) and use a fixed size_hint_min which is None by default.
In the code scroll_box checks minimal size of children (a UIBoxLayout with dummies ; UIAnchorLayout: 0,0)
and resizes, which causes the UIAnchorLayout to collabs and it gets drawn above the UIBoxLayout.
Another thing:
self.entry_box_2=gui.UIAnchorLayout(
width=self.width, height=150, children=(gui.UIDummy()) # there is a `,` missing -> (gui.UIDummy(),)
)
While the code does not crash, the constructor gets only the dummy and not a tuple, which causes the internal code to loop over the children of UIDummy, but there are non.
I def think the first two should be implemented as warnings as they cause very intuitive issues and are almost always going to be unintentional. The last one I could see being useful when you have one child of a layout that you want to fill the layout fully. Maybe the last one should just be a type hint so type-checking complains but it's not actually prohibited?
Activity
eruvanos commentedon Feb 15, 2026
Within the code Layouts are given a size, but the size_hint is not set to
None, which means the defaults apply and the sizes are overwritten.UIBoxLayouts have default:
size_hint=(0,0) and calculatesize_hint_minbased on children. UIAnchorLayout have defaultsize_hint=(1,1) and use a fixedsize_hint_minwhich isNoneby default.In the code
scroll_boxchecks minimal size of children (a UIBoxLayout with dummies ; UIAnchorLayout: 0,0)and resizes, which causes the UIAnchorLayout to collabs and it gets drawn above the UIBoxLayout.
Another thing:
While the code does not crash, the constructor gets only the dummy and not a tuple, which causes the internal code to loop over the children of UIDummy, but there are non.
The "fixed" code:
eruvanos commentedon Feb 15, 2026
Result:
Things that came to my mind to improve the code:
size_hint_minso it is consistent and works better in UIBoxLayouts.What do you thing?
DragonMoffon commentedon Mar 15, 2026
I def think the first two should be implemented as warnings as they cause very intuitive issues and are almost always going to be unintentional. The last one I could see being useful when you have one child of a layout that you want to fill the layout fully. Maybe the last one should just be a type hint so type-checking complains but it's not actually prohibited?