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

Clicking Buttons in Dash

Is there anyway to get my button clicked without actually clicking it with mouse.
Lets say after every 5 second i want to get my button made with DASH clicked. How can i do that?

I think if you use n_clicks attribute you can define 2 callbacks:

  1. a callback to change n_clicks attribute every 5 seconds
  2. a callback to read n_clicks and then do an action

The second callback will be triggered after the first callback update n_clicks.Something similar to the example: Dash App With Chained Callbacks https://dash.plotly.com/basic-callbacks


You can use the dcc.Interval component that does just that.

1 Like

@danielT43 @RenaudLN . Thanks, Your solution is perfectly fine. Actually I just gave a scenario,my real problem is I will be reading a value from a text file.Lets say the value read at some instance is 5 , then I have to get my Button clicked, else not.Further Response will be appreciated.

Or keeping it simple…
if(x>5 or x==2):
button gets clicked