Learn how to use Dash Bio for next-gen sequencing & quality control. 🧬Register for the Oct 27 webinar.

Dash Events Button

I have an app that is using an Events button to reset a hundred other buttons and I recently upgraded Dash, core and html components to the latest version, only to find that the Events button is completely gone. I downgraded again, just to continue working on the app, but I’m still having the issue.

Does anyone know what version of dash or combination of dash and core, html version components I need to get back on track?? I’m using Dash 0.32.0 now.

On the issue of buttons here is some code for 4 Buttons;

https://github.com/robotwax/4-Dash-Buttons/blob/master/4-dash-button-test.py

Add here is code for unlimited buttons;

Events were removed from Dash in a recent update, and the won’t be added back in. Instead, you can use an Input in a callback that is listening for changes to the n_clicks property of any Dash component (such as html.Button)

See the Button example in the Dash docs: https://dash.plot.ly/dash-core-components/

OK, I figured it out. If anyone wants to use the events button, these versions of dash will get the job done. dash==0.30.0
dash-core-components==0.38.0
dash-html-components==0.13.2
dash-renderer==0.15.0

1 Like

Oh thats sad. I wanted to test the example described here:

What do I have to change to get it work?

I’ve not read the code in detail but it looks like all that needs to be done is remove the obsolete events part of the last 2 callbacks, so change:

@app.callback(Output('bin-auto', 'values'), [Input('bin-slider', 'value')],
              [State('wind-speed', 'figure')],
              [Event('bin-slider', 'change')])

To:

@app.callback(Output('bin-auto', 'values'), [Input('bin-slider', 'value')],
              [State('wind-speed', 'figure')])

And change:

@app.callback(Output('bin-size', 'children'), [Input('bin-auto', 'values')],
              [State('bin-slider', 'value')],
              [])

To:

@app.callback(Output('bin-size', 'children'), [Input('bin-auto', 'values')],
              [State('bin-slider', 'value')])

Beautiful! Thanks for sharing this @robotwax.

Hey thanks. I’ve since realised that that method is over complicated. It should be possible to use the inbuilt max(), which would make the code significantly shorter and a heck of a lot faster. :slight_smile: