I adapted (tried to simplify) an example on the “dcc.Input” page:
https://dash.plotly.com/dash-core-components/input
The output is good, but I am getting an error message on the web page:
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
When I converted the Fahrenheit to Celsius equation to float, I got the following error message:
TypeError: float() argument must be a string or a real number, not 'NoneType'
This probably has more to do with my weak knowledge of Python than Bash or Plotly, but I don’t konw what to do. Thank you.
from dash import Dash, html, dcc, callback, Output, Input
app = Dash(__name__, title='A_CD-02')
app.layout = html.Div(
[
html.Div('American temperature ?'),
dcc.Input(
id="input_F", type="number", placeholder="Fahrenheit",
# min=10, max=100, step=3,
),
html.Hr(),
html.Div(id="output_C"),
]
)
@callback(
Output("output_C", "children"),
Input("input_F", "value")
)
def number_render(fahrenheit):
celsius = (fahrenheit-32) * 5 / 9
return celsius
if __name__ == "__main__":
app.run_server(debug=True)