.controllers._ui.Animation

class controllers._ui.animation.Animation(view: PySimpleGUI.PySimpleGUI.Window, gif_info: model.gif_info.GifInfo)

Controls and generates PySimpleGUI Window events related to the currently displayed GIF animation.

Initializer

controllers._ui.Animation.__init__(self, view: PySimpleGUI.PySimpleGUI.Window, gif_info: model.gif_info.GifInfo)

Initializes a new Animation object.

Parameters
  • view (sg.Window) – PySimpleGUI Window to control

  • gif_info (model.GifInfo) – Object containing the GIF file information


Location

/controllers/_ui/animation.py

Instance functions

controllers._ui.Animation.start(self)

Starts a thread that generates animation events.


controllers._ui.Animation.hide_and_pause(self)

Hides current view and stops the animation thread.


controllers._ui.Animation.unhide_and_resume(self)

Shows currently hidden view and restarts the animation thread.


Internal instance function

controllers._ui.Animation._frame_events(self, n_frames: int, stop) None

Needs to be called within a thread.

Generates a PySimpleGUI Window event tuple: (“NextFrame”, n) every 0.01 second,

where “n” is the current gif frame index.

Parameters
  • n_frames (int) – Total number of frames

  • stop (() -> bool) – Returns _stop_animation flag state


Source code (on GitHub)