Skip to content

arcade.View hints the wrong type for height and width #2525

Closed
@elegantiron

Description

@elegantiron

The View.width and View.height properties both claim to be aliases for Window.width and Window.height respectively. They also directly return those properties. View.width and View.height, however, have type hints for float return types.

arcade/arcade/application.py

Lines 1552 to 1564 in cdd6f66

@property
def width(self) -> float:
"""
An alias for `arcade.Window.width`
"""
return self.window.width
@property
def height(self) -> float:
"""
An alias for `arcade.Window.height`
"""
return self.window.height

The definitions for Window.width and Window.height, however, hint that they return int types.

https://github.com/pyglet/pyglet/blob/ce6889687a4e99136d38fcd63a01b5b350ebd5ac/pyglet/window/__init__.py#L1218-L1234

    @property
    def width(self) -> int:
        """The width of the window, in pixels.  Read-write."""
        return self.get_size()[0]


    @width.setter
    def width(self, new_width: int) -> None:
        self.set_size(new_width, self.height)


    @property
    def height(self) -> int:
        """The height of the window, in pixels.  Read-write."""
        return self.get_size()[1]


    @height.setter
    def height(self, new_height: int) -> None:
        self.set_size(self.width, new_height)

The return type hints for View.width and View.height should be updated to reflect that they return ints

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions