Skip to content

Cb image

CbImage

Bases: CbBase

Base Image class. Given an optional filepath and a CbImageRenderer object, adds an image to the report.

Parameters:

Name Type Description Default

image_renderer

ImageRenderGeneric

The rendering mode of the image.

required

filepath

Optional[str]

The file name of the resource including the extension, this is set relative to the folder path. The folder path is dependent up on the is_local parameter. To denote folder structure, "/" should be used between folders. Default = None.

None

var_name

Optional[str]

This must be a unique identifying name. Default = None.

None

fullname

str

The full name of the parameter, can be descriptive. Default = None.

None

image_caption

str

The text attributed to the image. Default = "".

''

image_width

str

The display image size in pixels. Recommended max width is 450.

450

is_local

bool

If local the file should reside within the parent folder of this app. Alternatively, this can be set to False and the file should be located within the "shared" folder. Default = True

True

visible

bool

Set False to hide the component from the "Detail Output" section. Default = True

True

tooltip_text

str

Text to display as a tooltip in the webapp. Default = None.

None

Returns:

Type Description

CbImage instance

Examples:

1
2
3
4
5
6
image_renderer = ImageRenderExpandable(is_expanded=True)
cb_image = CbImage(
    filepath="images/shared_image.png",
    image_renderer=image_renderer,
    var_name="an_image",
    is_local=False)

ImageRenderBasic

Bases: ImageRenderGeneric

Simply adds the image and the caption below it.

Args:

Returns:

Type Description

ImageRenderBasic Instance

Examples:

1
render_basic = ImageRenderBasic()

ImageRenderExpandable

Bases: ImageRenderGeneric

Adds an expandable container with the image and caption. The container can be expanded/minimized by clicking on the expand button of the container.

Parameters:

Name Type Description Default

is_expanded

bool

Set to False if you want the container to be minimized by default. Default = True.

True

Returns:

Type Description

ImageRenderExpandable Instance

Examples:

1
render_expandable = ImageRenderExpandable(is_expanded=False)

Bases: ImageRenderGeneric

Adds a clickable link to the report. When clicked, a pop-up opens with the image and caption.

Parameters:

Name Type Description Default

display_text

str

The text content of the link. Default = "Click here to open the image".

'Click here to open the image'

Returns:

Type Description

ImageRenderLink Instance

Examples:

1
render_link = ImageRenderLink(display_text="Please click here to open the image!")