Skip to content

Nested UIGridLayouts are not shown #1962

@eruvanos

Description

@eruvanos

Bug Report

Nested UIGridLayouts are sized to 0,0 which makes them invisible.

System Info

arcade: 3.x

Expected behavior:

UIGridLayout should handle size_hint_min of nested UIGridLayouts

Steps to reproduce/example code:

import arcade
from arcade import Window
from arcade.gui import UIManager, UIGridLayout, UILabel, UIAnchorLayout

class MyWindow(Window):
    def __init__(self):
        super().__init__()

        self.ui = UIManager()
        self.ui.enable()

        # code to reproduce the error goes here
        outer_grid = UIGridLayout(column_count=3, row_count=3)
        outer_grid.with_border()
        for i in range(3):
            for j in range(3):
                inner_grid = UIGridLayout(column_count=2, row_count=2)
                inner_grid.with_border()
                for k in range(4):
                    col = k % 2
                    row = k // 2
                    label = UILabel(text=f"Inner {k}")
                    inner_grid.add(label, col_num=col, row_num=row)
                outer_grid.add(inner_grid, col_num=j, row_num=i)
        anchor_layout = UIAnchorLayout()
        anchor_layout.add(outer_grid)
        self.ui.add(anchor_layout)

        self.ui._do_layout()
        print(inner_grid.rect)

    def on_draw(self):
        self.clear(color=arcade.color.GRAY)
        self.ui.draw()


if __name__ == "__main__":
    MyWindow().run()

Metadata

Metadata

Assignees

Labels

guiRelated to arcade GUI (sub module arcade.gui)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions