本文整理匯總了Python中dash.dependencies.Output方法的典型用法代碼示例。如果您正苦於以下問題:Python dependencies.Output方法的具體用法?Python dependencies.Output怎麽用?Python dependencies.Output使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dash.dependencies
的用法示例。
在下文中一共展示了dependencies.Output方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_callbacks
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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
示例2: test_surface_selector
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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)
示例3: add_callbacks
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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)
示例4: get_output
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
def get_output(self, attribute_name):
return Output(self.full_name, attribute_name)
示例5: update_rows
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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
示例6: display_value_1
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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())
])
示例7: display_value_2
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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())
])
示例8: plugin_data_output
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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")
示例9: container_data_output
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
def container_data_output(self) -> Output:
warnings.warn(
("Use 'plugin_data_output' instead of 'container_data_output'"),
DeprecationWarning,
)
return self.plugin_data_output
示例10: plot_output_callbacks
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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
示例11: test_flat_button
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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')
示例12: test_raised_button
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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')
示例13: add_include_transformed_callback
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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
)
示例14: add_callbacks
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
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)
示例15: update_output_div
# 需要導入模塊: from dash import dependencies [as 別名]
# 或者: from dash.dependencies import Output [as 別名]
def update_output_div(input_value):
return 'Output: {}'.format(input_value)