Using Dash

Reviews and other little ventures that don't quite fit into the other forums
Post Reply
Daniel Wee
Site Admin
Posts: 2129
Joined: Wed 25 Feb 25 2009 8:00 pm

Using Dash

Post by Daniel Wee » Thu 12 Apr 12 2018 1:17 pm

Code: Select all

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

# define the layout of the page
app.layout = html.Div([
	dcc.Input(id='input', value='Enter something here!', type='text'),

# define the callback function
# this decorator function replaces some called function and performs the actual value update
# the function to update the value must immediately follow this decorator
	# change element marked 'output' whenever element 'input' changes its 'value'
	Output(component_id='output', component_property='children'),
	[Input(component_id='input', component_property='value')]
def update_value(input_data):
	return 'Input: "{}"'.format(input_data)

if __name__ == "__main__":

Post Reply