Skip to content

GUI: UIGridLayout elements not centered #2210

@eruvanos

Description

@eruvanos

Bug Report

Creating a UIGridLayout with one column or one row plus spacing, the widget is not placed centered.

System Info

Run this and paste the output here: python -m arcade

Actual behavior:

UIGridLayout applies the horizontal/vertical spacing even when only one row/column exists

Expected behavior:

No spacing for single row/column

Steps to reproduce/example code:

def test_widgets_are_centered(window):
    ui = UIManager()
    grid = UIGridLayout(row_count=1, column_count=1, horizontal_spacing=10, vertical_spacing=10)
    ui.add(grid)

    dummy1 = UIDummy(width=100, height=100)
    grid.add(dummy1, 0, 0)

    ui.execute_layout()

    assert dummy1.rect.bottom_left == Vec2(0, 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    guiRelated to arcade GUI (sub module arcade.gui)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions