Narrator API
The Narrator has several methods which can change the logging behavior as you need.
- class Narrator(adapters: list[Adapter] | None = None)
The narrator conveys the story to the audience.
- off_the_air() Generator
Turns off narration completely during this context.
- mic_cable_kinked() Generator
Put a kink in the microphone line, storing narrations.
Once this context is left, all stored narrations will be flushed. You can call clear_backup to drop all stored narrations, or flush_backup to log them all (and clear them afterward).
- narrate(channel: str, **kwargs: Kwargs | None) ContextManager
Speak the message into the microphone plugged in to all the adapters.
- announcing_the_act(func: Callable, line: str, gravitas: str | None = None) ContextManager
Narrate the title of the act.
- setting_the_scene(func: Callable, line: str, gravitas: str | None = None) ContextManager
Narrate the title of the scene.
- stating_a_beat(func: Callable, line: str, gravitas: str | None = None) ContextManager
Narrate an emotional beat.
Adapters
There is one adapter included in ScreenPy,
which allows the Narrator
to reach stdout
.