Pn
ipyvizzustory.env.pn
Panel environment dependent modules.
ipyvizzustory.env.pn.story
A module for working with presentation stories in Panel environment.
Story
Bases: StoryLib
A class for representing a presentation story in Panel environment.
Source code in ipyvizzustory/env/pn/story.py
class Story(StoryLib):
"""A class for representing a presentation story in Panel environment."""
def __init__(self, data: Data, style: Optional[Style] = None):
"""
Presentation Story constructor.
Args:
data: Data set for the whole presentation story.
After initialization `data` can not be modified,
but it can be filtered.
style: Style settings for the presentation story.
`style` can be changed at each presentation step.
"""
super().__init__(data=data, style=style)
def play(self) -> None:
"""
A method for displaying the assembled html code in Panel environment.
Raises:
ValueError: If `width` or `height` is not in pixel.
"""
if any(
[
not StorySize.is_pixel(self._size.width),
not StorySize.is_pixel(self._size.height),
]
):
raise ValueError("width and height should be in pixels")
HTML(
self.to_html(),
width=int(self._size.width[:-2]), # type: ignore
height=int(self._size.height[:-2]), # type: ignore
).servable()
__init__(data, style=None)
Presentation Story constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Data
|
Data set for the whole presentation story.
After initialization |
required |
style |
Optional[Style]
|
Style settings for the presentation story.
|
None
|
Source code in ipyvizzustory/env/pn/story.py
def __init__(self, data: Data, style: Optional[Style] = None):
"""
Presentation Story constructor.
Args:
data: Data set for the whole presentation story.
After initialization `data` can not be modified,
but it can be filtered.
style: Style settings for the presentation story.
`style` can be changed at each presentation step.
"""
super().__init__(data=data, style=style)
play()
A method for displaying the assembled html code in Panel environment.
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in ipyvizzustory/env/pn/story.py
def play(self) -> None:
"""
A method for displaying the assembled html code in Panel environment.
Raises:
ValueError: If `width` or `height` is not in pixel.
"""
if any(
[
not StorySize.is_pixel(self._size.width),
not StorySize.is_pixel(self._size.height),
]
):
raise ValueError("width and height should be in pixels")
HTML(
self.to_html(),
width=int(self._size.width[:-2]), # type: ignore
height=int(self._size.height[:-2]), # type: ignore
).servable()