Scrubber for Interact Decorator

Hello,

I have something like this:

@pn.interact(ts=range(len(lgm_awiesm2p1_fesom_temp_50m_ds.time)))
def plot_ts(ts):
    return plot_holoviews(lgm_mesh, lgm_awiesm2p1_fesom_temp_50m_ds.isel(time=ts))

Currently, the widget displays as a slider. Is there any way to get it to be a scrubber so I can do “movie mode”?

Best,
Paul

Found the answer to that here: https://panel.holoviz.org/reference/widgets/Player.html

Effectively, you just need to create the widget you want to use in interact manually:

@pn.interact(ts=pn.widgets.Player(name='Player', start=-100, end=-1, value=-100, loop_policy='loop'))
def plot_ts(ts):
    return plot_holoviews(lgm_mesh, lgm_awiesm2p1_fesom_temp_50m_ds.isel(time=ts))

That results in something you can scrub through with the player widget which has play, pause, speed up, look controls, etc.

1 Like