Python dash.dependencies.Output() Examples
The following are 19
code examples of dash.dependencies.Output().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
dash.dependencies
, or try the search function
.
Example #1
Source File: dash-callback-factory.py From dash-recipes with MIT License | 6 votes |
def create_callbacks(): def delete(i): def callback(*data): return """# Delete {}""".format(datetime.now().time().isoformat()) return callback def toggle(i): def callback(*data): return "Toggle {}".format(datetime.now().time().isoformat()) return callback for model_id in IDS: try: app.callback(Output('model-{}-markdown'.format(model_id), 'children'), events=[Event('model-{}-delete-button'.format(model_id), 'click')])(delete(model_id)) app.callback(Output('model-{}-p'.format(model_id), 'children'), events=[Event('model-{}-toggle-button'.format(model_id), 'click')])(toggle(model_id)) except CantHaveMultipleOutputs: continue
Example #2
Source File: index.py From webmc3 with Apache License 2.0 | 6 votes |
def add_callbacks(app, trace_info): bivariate_layout = bivariate.layout(trace_info) univariate_layout = univariate.layout(trace_info) @app.callback( dep.Output('page-content', 'children'), [dep.Input('url', 'pathname')] ) def update_page_content(pathname): if pathname in ['/', '/univariate']: return univariate_layout elif pathname == '/bivariate': return bivariate_layout bivariate.add_callbacks(app, trace_info) univariate.add_callbacks(app, trace_info)
Example #3
Source File: test_surface_selector.py From webviz-subsurface with GNU General Public License v3.0 | 6 votes |
def test_surface_selector(dash_duo): app = dash.Dash(__name__) app.config.suppress_callback_exceptions = True realizations = pd.read_csv("tests/data/realizations.csv") s = SurfaceSelector(app, surface_context, realizations) app.layout = html.Div(children=[s.layout, html.Pre(id="pre", children="ok")]) @app.callback(Output("pre", "children"), [Input(s.storage_id, "data")]) def _test(data): return json.dumps(json.loads(data)) dash_duo.start_server(app) dash_duo.wait_for_contains_text("#pre", json.dumps(return_value), timeout=4)
Example #4
Source File: callbacks.py From dash_on_flask with MIT License | 5 votes |
def register_callbacks(dashapp): @dashapp.callback(Output('my-graph', 'figure'), [Input('my-dropdown', 'value')]) def update_graph(selected_dropdown_value): df = pdr.get_data_yahoo(selected_dropdown_value, start=dt(2017, 1, 1), end=dt.now()) return { 'data': [{ 'x': df.index, 'y': df.Close }], 'layout': {'margin': {'l': 40, 'r': 0, 't': 20, 'b': 30}} }
Example #5
Source File: main.py From deep_architect with MIT License | 5 votes |
def get_output(self, attribute_name): return Output(self.full_name, attribute_name)
Example #6
Source File: sharing_state_filesystem_sessions.py From dash-docs with MIT License | 5 votes |
def display_value_2(value, session_id): df = get_dataframe(session_id) return html.Div([ 'Output 2 - Button has been clicked {} times'.format(value), html.Pre(df.to_csv()) ])
Example #7
Source File: sharing_state_filesystem_sessions.py From dash-docs with MIT License | 5 votes |
def display_value_1(value, session_id): df = get_dataframe(session_id) return html.Div([ 'Output 1 - Button has been clicked {} times'.format(value), html.Pre(df.to_csv()) ])
Example #8
Source File: getting_started_interactive_simple.py From dash-docs with MIT License | 5 votes |
def update_output_div(input_value): return 'Output: {}'.format(input_value)
Example #9
Source File: components.py From webmc3 with Apache License 2.0 | 5 votes |
def add_callbacks(app, trace_info): add_include_transformed_callback(app, 'bivariate-x', trace_info) add_include_transformed_callback(app, 'bivariate-y', trace_info) @app.callback( dep.Output('bivariate-scatter', 'figure'), [ dep.Input('bivariate-x-selector', 'value'), dep.Input('bivariate-y-selector', 'value') ] ) def update_bivariate_scatter(x_varname, y_varname): return scatter_figure(trace_info, x_varname, y_varname)
Example #10
Source File: components.py From webmc3 with Apache License 2.0 | 5 votes |
def add_include_transformed_callback(app, title, trace): @app.callback( dep.Output('{}-selector'.format(title), 'options'), [dep.Input( '{}-selector-include-transformed'.format(title), 'values' )] ) def update_selector_transformed(values): return get_varname_options( trace, include_transformed=values )
Example #11
Source File: test_integration.py From sd-material-ui with MIT License | 5 votes |
def test_raised_button(self): app = dash.Dash(__name__) app.layout = html.Div([ html.Div(id='waitfor'), sd_material_ui.SDRaisedButton('test', id='raised-button'), html.Div(children=[ html.Span('num clicks:'), html.Span(0, id='test-span-output'), ], id='test-output') ]) @app.callback( output=Output(component_id='test-span-output', component_property='children'), inputs=[Input(component_id='raised-button', component_property='n_clicks')]) def click_button(n_clicks: int) -> int: if n_clicks is not None and n_clicks > 0: return n_clicks self.startServer(app) waiter(self.wait_for_element_by_id) self.driver.find_element_by_css_selector('#raised-button button').click() self.assertEqual(self.driver.find_element_by_id('test-span-output').text, '1') self.driver.find_element_by_css_selector('#raised-button button').click() self.assertEqual(self.driver.find_element_by_id('test-span-output').text, '2')
Example #12
Source File: test_integration.py From sd-material-ui with MIT License | 5 votes |
def test_flat_button(self): app = dash.Dash(__name__) app.layout = html.Div([ html.Div(id='waitfor'), sd_material_ui.SDFlatButton('test', id='flat-button'), html.Div(children=[ html.Span('num clicks:'), html.Span(0, id='test-span-output'), ], id='test-output') ]) @app.callback( output=Output(component_id='test-span-output', component_property='children'), inputs=[Input(component_id='flat-button', component_property='n_clicks')]) def click_button(n_clicks: int) -> int: if n_clicks is not None and n_clicks > 0: return n_clicks self.startServer(app) waiter(self.wait_for_element_by_id) self.driver.find_element_by_css_selector('#flat-button button').click() self.assertEqual(self.driver.find_element_by_id('test-span-output').text, '1') self.driver.find_element_by_css_selector('#flat-button button').click() self.assertEqual(self.driver.find_element_by_id('test-span-output').text, '2')
Example #13
Source File: _table_plotter.py From webviz-config with MIT License | 5 votes |
def plot_output_callbacks(self) -> List[Output]: """Creates list of output dependencies for callback The outputs are the graph, and the style of the plot options""" outputs = [] outputs.append(Output(self.uuid("graph-id"), "figure")) for plot_arg in self.plot_args.keys(): outputs.append(Output(self.uuid(f"div-{plot_arg}"), "style")) return outputs
Example #14
Source File: _plugin_abc.py From webviz-config with MIT License | 5 votes |
def container_data_output(self) -> Output: warnings.warn( ("Use 'plugin_data_output' instead of 'container_data_output'"), DeprecationWarning, ) return self.plugin_data_output
Example #15
Source File: _plugin_abc.py From webviz-config with MIT License | 5 votes |
def plugin_data_output(self) -> Output: # pylint: disable=attribute-defined-outside-init # We do not have a __init__ method in this abstract base class self._add_download_button = True return Output(self._plugin_wrapper_id, "zip_base64")
Example #16
Source File: dash-cache-signal-session.py From dash-recipes with MIT License | 5 votes |
def display_value_2(value, session_id): df = get_dataframe(session_id) return html.Div([ 'Output 2 - Button has been clicked {} times'.format(value), html.Pre(df.to_csv()) ])
Example #17
Source File: dash-cache-signal-session.py From dash-recipes with MIT License | 5 votes |
def display_value_1(value, session_id): df = get_dataframe(session_id) return html.Div([ 'Output 1 - Button has been clicked {} times'.format(value), html.Pre(df.to_csv()) ])
Example #18
Source File: dash-datatable-editable-update-self.py From dash-recipes with MIT License | 5 votes |
def update_rows(row_update, rows): row_copy = copy.deepcopy(rows) if row_update: updated_row_index = row_update[0]['from_row'] updated_value = row_update[0]['updated'].values()[0] row_copy[updated_row_index]['Output'] = ( float(updated_value) ** 2 ) return row_copy
Example #19
Source File: components.py From webmc3 with Apache License 2.0 | 4 votes |
def add_callbacks(app, trace_info): add_include_transformed_callback(app, 'univariate', trace_info) @app.callback( dep.Output('univariate-autocorr', 'figure'), [ dep.Input('univariate-selector', 'value'), dep.Input('univariate-lines', 'relayoutData') ] ) def update_autocorr(varname, relayoutData): ix_slice = get_ix_slice(relayoutData) return autocorr_figure(trace_info, varname, ix_slice=ix_slice) @app.callback( dep.Output('univariate-effective-n', 'children'), [dep.Input('univariate-selector', 'value')] ) def update_effective_n(varname): return effective_n_p(trace_info, varname) @app.callback( dep.Output('univariate-gelman-rubin', 'children'), [dep.Input('univariate-selector', 'value')] ) def update_gelman_rubin(varname): return gelman_rubin_p(trace_info, varname) @app.callback( dep.Output('univariate-hist', 'figure'), [ dep.Input('univariate-selector', 'value'), dep.Input('univariate-lines', 'relayoutData') ] ) def update_hist(varname, relayoutData): ix_slice = get_ix_slice(relayoutData) return hist_figure(trace_info, varname, ix_slice=ix_slice) @app.callback( dep.Output('univariate-lines', 'figure'), [dep.Input('univariate-selector', 'value')] ) def update_lines(varname): return lines_figure(trace_info, varname)