Skip to content

image_viewer

image_viewer #

ImageViewer — one picture with an optional caption.

ImageViewer #

Bases: Component

A single image and its caption.

cg.ui.ImageViewer(target.reference, caption="The marked spot")
Source code in capturegraph-lib/capturegraph/ui/image_viewer.py
class ImageViewer(Component):
    """A single ``image`` and its ``caption``.

    ```python
    cg.ui.ImageViewer(target.reference, caption="The marked spot")
    ```
    """

    image: Image
    caption: str | None = None

    def html(self, render: Render) -> str:
        """A figure of the staged image."""
        return picture(render.stage(self.image), self.caption)

html(render) #

A figure of the staged image.

Source code in capturegraph-lib/capturegraph/ui/image_viewer.py
def html(self, render: Render) -> str:
    """A figure of the staged image."""
    return picture(render.stage(self.image), self.caption)