Exemplo n.º 1
0
 def _set_visible(self, visible):
     self._visible = visible
     clock.unschedule(self._blink)
     if visible and self._active and self.PERIOD:
         clock.schedule_interval(self._blink, self.PERIOD)
         self._blink_visible = False # flipped immediately by next blink
     self._blink(0)
Exemplo n.º 2
0
    def _set_image(self, img):
        if self._animation is not None:
            clock.unschedule(self._animate)
            self._animation = None

        if isinstance(img, image.Animation):
            self._animation = img
            self._frame_index = 0
            self._set_texture(img.frames[0].image.get_texture())
            self._next_dt = img.frames[0].duration
            if self._next_dt:
                clock.schedule_once(self._animate, self._next_dt)
        else:
            self._set_texture(img.get_texture())
        self._update_position()
Exemplo n.º 3
0
    def delete(self):
        '''Force immediate removal of the sprite from video memory.

        This is often necessary when using batches, as the Python garbage
        collector will not necessarily call the finalizer as soon as the
        sprite is garbage.
        '''
        if self._animation:
            clock.unschedule(self._animate)
        self._vertex_list.delete()
        self._vertex_list = None
        self._texture = None

        # Easy way to break circular reference, speeds up GC
        self._group = None