Main API

The following three decorator functions/classes constitute the main API of clanimtk. They are all included in the package __init__, so all of them are imported on the form from clanimtk import <MEMBER>.

clanimtk.animate(func=None, *, animation=<clanimtk.core.Animation object>, step=0.1)[source]

Wrapper function for the _Animate wrapper class.

Parameters:
  • func (Optional[Callable[…, Any]]) – A function to run while animation is showing.
  • animation (Generator[str, None, None]) – An AnimationGenerator that yields animation frames.
  • step (float) – Approximate timestep (in seconds) between frames.
Return type:

Callable[…, Any]

Returns:

An animated version of func if func is not None. Otherwise, a function that takes a function and returns an animated version of that.

clanimtk.animation(frame_function)[source]

Turn a FrameFunction into an Animation.

Parameters:frame_function (Callable[…, Generator[str, None, None]]) – A function that returns a FrameGenerator.
Return type:Callable[…, Generator[str, None, None]]
Returns:an Animation decorator function.
clanimtk.annotate(*, start_msg=None, end_msg=None, start_no_nl=False)[source]

A decorator meant for decorating functions that are decorated with the animate decorator. It prints a message to stdout before and/or after the function has finished.

Danger

This decorator can also be used standalone, but you should NOT decorate a function that is decorated with annotate with animate. That is to say, the decorator order must be like this:

@annotate
@animate
def some_function()
    pass
Return type:Callable[…, Any]