fetch up pyglet [build skip]

This commit is contained in:
shenjack 2023-04-05 19:38:31 +08:00
parent 0ab71ee2f3
commit d95e23a7f4
2 changed files with 9 additions and 3 deletions

View File

@ -239,6 +239,12 @@ class ShapeBase(ABC):
self._group.unset_state_recursive() self._group.unset_state_recursive()
def delete(self): def delete(self):
"""Force immediate removal of the shape from video memory.
It is recommended to call this whenever you delete a shape,
as the Python garbage collector will not necessarily call the
finalizer as soon as the sprite falls out of scope.
"""
self._vertex_list.delete() self._vertex_list.delete()
self._vertex_list = None self._vertex_list = None

View File

@ -323,9 +323,9 @@ class Sprite(event.EventDispatcher):
def delete(self): def delete(self):
"""Force immediate removal of the sprite from video memory. """Force immediate removal of the sprite from video memory.
This is often necessary when using batches, as the Python garbage It is recommended to call this whenever you delete a sprite,
collector will not necessarily call the finalizer as soon as the as the Python garbage collector will not necessarily call the
sprite is garbage. finalizer as soon as the sprite falls out of scope.
""" """
if self._animation: if self._animation:
clock.unschedule(self._animate) clock.unschedule(self._animate)