I’m developing a multi page dashboard using python Dash . On the main page I have created a layout that has an ‘Submit’ button . So when the user selects options and clicks the Submit button it should call another .py script and should display that on the same page .
Index.py is the main program Layout.py has the layouts new1.py has the layout that has ‘Submit Button’ new2.py is the script that needs to be displayed on clicking the submit button
Here is the code in new1.py where I have declared button
html.Button('Clear',id='clear_button', n_clicks=0, style = { 'width' : '30%', 'margin-top': ' I'm developing a multi page dashboard using python Dash . On the main page I have created a layout that has an 'Submit' button . So when the user selects options and clicks the Submit button it should call another .py script and should display that on the same page .
Index.py is the main program Layout.py has the layouts new1.py has the layout that has 'Submit Button' new2.py is the script that needs to be displayed on clicking the submit button
Here is the code in new1.py where I have declared button
html.Button('Clear',id='clear_button', n_clicks=0, style = { 'width' : '30%', 'margin-top': '15vw', "margin":"15px" ,'border-radius': '8px'})
``
Index.py that has the call back for button
@app.callback(
dash.dependencies.Output('apply_button', 'children'),
[dash.dependencies.Input('button', 'n_clicks')])
def run_script_onClick(n_clicks):
if not n_clicks:
raise PreventUpdate
script_path = 'python new2.py'
call(["python3", script_path])
return output_content
Is this correct ? When I click the Apply button nothing is coming. I want the output of the new2.py to be displayed on the same screen. Also where should i give the call back statement . In Index.py or in the new1.py ? Can someone help pls.
Thanks,
Meera