Hello, my project is coming along great. I have built a mini tax calculator. But i dont know how to store the output into an empty button / box. I have looked over input docs, and dont think thats what i need. Im not sure if i need a state or somthing? Just looking for guidence or pointed in the right direction so i can troubleshoot please.
Here is the code so far:
from multiprocessing.sharedctypes import Value
from dash import Dash, dcc, html, Input, Output
app = Dash(__name__)
app.layout = html.Div([
dcc.Dropdown({56: 'NYC',23: 'MTL', 54.3: 'SF'}, 56, id='demo-dropdown'),
html.Div(id='dd-output-container'
),
html.Br(),
html.Div([
"Product price: ",
dcc.Input(id='user-input', value=0, type='number'),
html.Div(id='dd-output-container2')
]),
html.Br(),
html.Div([
"Total with tax: ",
dcc.Input(id='blank-input', value=0, type='number'),
html.Div(id='Combined-output')
]),
])
@app.callback(
Output('dd-output-container', 'children'),
Output('dd-output-container2', 'children'),
Output('Combined-output', 'children'),
Input('demo-dropdown', 'value'),
Input('user-input', 'value'),
Input('blank-input', 'value'),
)
def update_output(value, value1, value3):
# This is the value from the dictionary and turns it into a decimal (value)
sales_converstion = (float(value) /100)
# This is the decimal multiplied by the user input whhich is (value 1)
Sales_tax = (sales_converstion * value1)
# Then we add value to value1 - which is the salesconverstion
Total_amount = (Sales_tax + value1)
value3 = Total_amount
return f'The state tax is: % {value}', f' {value1}', f' {value3}'
if __name__ == '__main__':
app.run_server(debug=True)
Thanks for any help