-
Notifications
You must be signed in to change notification settings - Fork 358
Closed
Milestone
Description
Bug Report
System Info
Run this and paste the output here: python -m arcade
Arcade 3.0.0.dev24
vendor: Intel
renderer: Intel(R) UHD Graphics
version: (3, 3)
python: 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)]
platform: win32
pyglet version: 2.0.8
PIL version: 9.4.0
Actual behavior:
The "atlas" property of SpriteList crashes with an AttributeError if there is no window or if the SpriteList is lazy and has not been fully initialized (init_deferred) yet. The reason is that "self._atlas" is not set at all in these cases.
The error is very deceptive: AttributeError: 'SpriteList' object has no attribute '_atlas'. Did you mean: 'atlas'?
Expected behavior:
I would expect calling the "atlas" property to, e.g., do one of
- actually run init_deferred so there is an atlas to return
- raise a better error (AttributeError for a private attribute makes it look like a programming error)
- return None (this probably has too big consequences, so I would be wary of this).
Steps to reproduce/example code:
import arcade
class IssueDemonstrationWindow(arcade.Window):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
sl = arcade.SpriteList(lazy=True)
sl.atlas
window = IssueDemonstrationWindow()
arcade.run()
Metadata
Metadata
Labels
No labels
Type
Projects
Status
Done