I wish to perform three successive measurements when a button is clicked. But the user should position a sensor before each measurement and the program should ask for confirmation before each measurement.
The dcc confirmDialog (ConfirmDialog | Dash for Python Documentation | Plotly) or confirmDialogProvider seem to be an option, but they are triggered when the user clicks a button.
Is there a way to trigger such a confirm dialog during the execution of a code?
Below is the structure of the callback executed when the button btn-start-meas is clicked where start_measure is a function that performs the desired measurement.
@app.callback(
Output(‘status’, ‘value’),
Input(‘btn-start-meas’, ‘n_clicks’),
prevent_initial_call = True
)
def make3measurements(btn):
<–Wait for confirmation–>
start_measure(1)
<–Wait for confirmation–>
start_measure(2)
<–Wait for confirmation–>
start_measure(3)