From 4754599a61bbf7f557edb722eb21df554e981d6e Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Sat, 7 Sep 2024 22:47:52 +0200 Subject: [PATCH] Fix 3.9 compatibility --- arcade/gui/view.py | 2 ++ arcade/gui/widgets/__init__.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arcade/gui/view.py b/arcade/gui/view.py index a4a7d52af..faf8a1384 100644 --- a/arcade/gui/view.py +++ b/arcade/gui/view.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from typing import TypeVar from arcade import View diff --git a/arcade/gui/widgets/__init__.py b/arcade/gui/widgets/__init__.py index 52c019728..67e2c49ab 100644 --- a/arcade/gui/widgets/__init__.py +++ b/arcade/gui/widgets/__init__.py @@ -5,7 +5,7 @@ from pyglet.event import EventDispatcher, EVENT_HANDLED, EVENT_UNHANDLED from pyglet.math import Vec2 -from typing_extensions import Self, reveal_type +from typing_extensions import Self import arcade from arcade import Sprite, Texture, LBWH, Rect @@ -60,15 +60,15 @@ class UIWidget(EventDispatcher, ABC): rect = Property(LBWH(0, 0, 1, 1)) visible = Property(True) - size_hint = Property[Optional[Tuple[float | None, float | None]]](None) - size_hint_min = Property[Tuple[float, float] | None](None) - size_hint_max = Property[Tuple[float, float] | None](None) + size_hint = Property[Optional[Tuple[Optional[float], Optional[float]]]](None) + size_hint_min = Property[Optional[Tuple[float, float]]](None) + size_hint_max = Property[Optional[Tuple[float, float]]](None) _children = ListProperty[_ChildEntry]() _border_width = Property(0) _border_color = Property(arcade.color.BLACK) - _bg_color = Property[Color | None]() - _bg_tex = Property[Texture | NinePatchTexture | None]() + _bg_color = Property[Optional[Color]]() + _bg_tex = Property[Union[Texture, NinePatchTexture, None]]() _padding_top = Property(0) _padding_right = Property(0) _padding_bottom = Property(0)