Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Which html.Button item() to use to run python script on clicking button?

$
0
0

@mirceau wrote:

Goal: I have never done this before, and am new to python. I want to run a python script on call as a button is pushed.

Question: My code below gives me an error. Which item() from this list should I consider to solve and meet my goal?

My Code:

**Button HTML**
    # Layout of Dash App HTML
    app.layout = html.Div(
        children=[
            html.Div(
                            html.Button('Detect', id='button'),
                            html.Div(id='output-container-button',
                            children='Hit the button to update.')
                         ],
                    ),
                ],
            )

@app.callback(
    dash.dependencies.Output('output-container-button', 'children'),
    [dash.dependencies.Input('button')])
def run_script_onClick():
    return os.system('python /Users/ME/Desktop/DSP_Frontend/Pipeline/Pipeline_Dynamic.py')

Currently this gives the error:

Traceback (most recent call last):
  File "app.py", line 592, in <module>
    [dash.dependencies.Input('button')])
TypeError: __init__() missing 1 required positional argument: 'component_property'

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles