# How to set callback input to figure.layout.slider in plotly animation?

**URL:** <https://community.plotly.com/t/how-to-set-callback-input-to-figure-layout-slider-in-plotly-animation/47102>\
**Category:** 📊 Plotly Python\
**Created:** [November 12, 2020, 2:42pm UTC](https://community.plotly.com/t/how-to-set-callback-input-to-figure-layout-slider-in-plotly-animation/47102 "2020-11-12T14:42:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lyhooi977](https://avatars.discourse-cdn.com/v4/letter/l/ecb155/32.png) [@lyhooi977](https://community.plotly.com/u/lyhooi977)\
**Post date:** [November 12, 2020, 2:42pm UTC](https://community.plotly.com/t/how-to-set-callback-input-to-figure-layout-slider-in-plotly-animation/47102/1 "2020-11-12T14:42:36Z")

</div>

I want get back the index of current value from the animation slider every time the slider value changes. I try to set input callback to fig[‘layout’][‘sliders’][0][‘active’] but it does not work out. Is there any way to achieve this?

```auto
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd                  
import plotly.express as px

app = dash.Dash( __name__ )

access_token = 'xxxxxxxxxx'
px.set_mapbox_access_token(access_token)

data_url = 'https://shahinrostami.com/datasets/time-series-19-covid-combined.csv'
data = pd.read_csv(data_url)

missing_states = pd.isnull(data['Province/State'])
data.loc[missing_states, 'Province/State'] = data.loc[missing_states, 'Country/Region']
data['Active'] = data['Confirmed'] - data['Recovered'] - data['Deaths']
data = data.dropna()
date_mask = data['Date'] == data['Date'].max()

fig = px.scatter_mapbox(
    data, lat="Lat", lon="Long",
    size="Active", size_max=50,
    color="Deaths", color_continuous_scale=px.colors.sequential.Pinkyl,
    hover_name="Province/State",
    mapbox_style='dark', zoom=1,
    animation_frame="Date", animation_group="Province/State",
    height=600,
)
app.layout = html.Div([
    dcc.Graph(id='my_graph', figure=fig),
    html.Div(id='label'),

])

@app.callback(Output("label", "children"),
                     [Input("my_graph", "figure['layout']['sliders'][0]['active']")])
def get_index(value):
    print(value)
    return value

if __name__ == ' __main__':
    app.run_server(debug=True)

```
