Carousel
Introduction
Function signature
Carousel(
items: List[Carousel.Item],
height=150,
initial_index=0,
trigger="hover",
autoplay=True,
interval=3000,
indicator_position="none",
arrow="hover",
type=None,
widget_id=None,
)# Example of local image
image_id = 22683828
static = os.path.join(sly.app.get_data_dir(), "static")
api.image.download_path(image_id, os.path.join(static, "image.jpg"))
items = [
Carousel.Item(name="Slide 1", label="https://www.w3schools.com/howto/img_nature.jpg"), # image by URL
Carousel.Item(name="Slide 2", label=f"{os.path.join('static', 'image.jpg')}"), # image from local directory
Carousel.Item(name="Slide 3", label="Lorem ipsum dolor sit amet", is_link=False), # text
Carousel.Item(name="Slide 4", label="https://www.quackit.com/pix/samples/18m.jpg"),
Carousel.Item(name="Slide 5", label="https://i.imgur.com/OpSj3JE.jpg"),
]
carousel = Carousel(items=items)Parameters
Parameters
Type
Description
items
height

initial_index
trigger
autoplay
interval

indicator_position

arrow

type

Methods and attributes
Attributes and Methods
Description
Mini App Example
Import libraries
Init API client
Prepare items for cascader
Initialize Carousel and Text widgets
Carousel and Text widgetsCreate app layout
Create app using layout
Add functions to control widgets from python code
Last updated