Skip to content

Commit 4cc2a87

Browse files
authored
Text int typing for positions to float (#2221)
* int typing to float because pyglet is lying * ✨black✨
1 parent 29164e5 commit 4cc2a87

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

arcade/text.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def _attempt_font_name_resolution(font_name: FontNameOrNames) -> FontNameOrNames
6161
:return: Either a resolved path or the original tuple
6262
"""
6363
if font_name:
64-
6564
# ensure
6665
if isinstance(font_name, str):
6766
font_list: tuple[str, ...] = (font_name,)
@@ -174,8 +173,8 @@ class Text:
174173
def __init__(
175174
self,
176175
text: str,
177-
x: int,
178-
y: int,
176+
x: float,
177+
y: float,
179178
color: RGBOrA255 = arcade.color.WHITE,
180179
font_size: float = 12,
181180
width: Optional[int] = 0,
@@ -189,7 +188,7 @@ def __init__(
189188
rotation: float = 0,
190189
batch: Optional[pyglet.graphics.Batch] = None,
191190
group: Optional[pyglet.graphics.Group] = None,
192-
z: int = 0,
191+
z: float = 0,
193192
):
194193
# Raises a RuntimeError if no window for better user feedback
195194
arcade.get_window()
@@ -203,9 +202,10 @@ def __init__(
203202
adjusted_font = _attempt_font_name_resolution(font_name)
204203
self._label = pyglet.text.Label(
205204
text=text,
206-
x=x,
207-
y=y,
208-
z=z,
205+
# pyglet is lying about what it takes here and float is entirely valid
206+
x=x, # type: ignore
207+
y=y, # type: ignore
208+
z=z, # type: ignore
209209
font_name=adjusted_font,
210210
font_size=font_size,
211211
# use type: ignore since cast is slow & pyglet used Literal

0 commit comments

Comments
 (0)