当前位置: 首页>>代码示例>>Python>>正文


Python dependencies.Input方法代码示例

本文整理汇总了Python中dash.dependencies.Input方法的典型用法代码示例。如果您正苦于以下问题:Python dependencies.Input方法的具体用法?Python dependencies.Input怎么用?Python dependencies.Input使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dash.dependencies的用法示例。


在下文中一共展示了dependencies.Input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: display_output

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def display_output(n_clicks):
    print('display_output ' + str(n_clicks))
    if n_clicks == 0:
        return ''
    return html.Div([
        html.Div([
            dcc.Input(
                value='Input {}'.format(i),
                id='input-{}'.format(i)
            )
            for i in range(10)
        ]),
        dt.DataTable(
            rows=[{'Loading': ''}],
            id='new-table'),
        html.Div(id='dynamic-output')
    ]) 
开发者ID:plotly,项目名称:dash-recipes,代码行数:19,代码来源:dash-dynamic-table-created-without-id.py

示例2: test_surface_selector

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [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) 
开发者ID:equinor,项目名称:webviz-subsurface,代码行数:18,代码来源:test_surface_selector.py

示例3: add_callbacks

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [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) 
开发者ID:AustinRochford,项目名称:webmc3,代码行数:18,代码来源:index.py

示例4: __init__

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def __init__(self, app: Dash):
        @app.callback(
            Output('hello_output', 'children'),
            [Input('hello_input', 'value')]
        )

        def update(hello_input: str):
            '''
            Takes in one arguement(s);
            - <hello_input>:   (str)

            Returns a layout_page matching requested pathname.
            '''
            # Some validation
            if len(hello_input) > 2:
                return f'Hello {hello_input}! Welcome to the app!' 
开发者ID:josharsh,项目名称:Learning-Object-Oriented-Python,代码行数:18,代码来源:hello.py

示例5: __init__

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def __init__(self, app, nav_items):
        """Initialise the navbar.

        Params:
        app:        A Dash instance to associate the router with.

        nav_items:  Ordered iterable of navbar items: tuples of `(route, display)`,
                    where `route` is a string corresponding to path of the route
                    (will be prefixed with Dash's 'routes_pathname_prefix') and
                    'display' is a valid value for the `children` keyword argument
                    for a Dash component (ie a Dash Component or a string).
        """
        self.nav_items = nav_items

        @app.callback(
            Output(server.config["NAVBAR_CONTAINER_ID"], "children"),
            [Input(server.config["LOCATION_COMPONENT_ID"], "pathname")],
        )
        def update_nav_callback(pathname):
            """Create the navbar with the current page set to active"""
            if pathname is None:
                # pathname is None on the first load of the app; ignore this
                raise PreventUpdate("Ignoring first Location.pathname callback")
            return self.make_nav(pathname) 
开发者ID:ned2,项目名称:slapdash,代码行数:26,代码来源:utils.py

示例6: get_input

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def get_input(self, attribute_name):
        return Input(self.full_name, attribute_name) 
开发者ID:negrinho,项目名称:deep_architect,代码行数:4,代码来源:main.py

示例7: __init__

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def __init__(self, parent_name, local_name, placeholder_text):
        Component.__init__(self, parent_name, local_name)
        self._register(
            dcc.Input(id=self.full_name,
                      placeholder=placeholder_text,
                      type='text',
                      value='',
                      style={'width': '100%'}))
        # value is an input attribute to read from callbacks. 
开发者ID:negrinho,项目名称:deep_architect,代码行数:11,代码来源:main.py

示例8: display_output

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def display_output(n_clicks):
    print('display_output ' + str(n_clicks))
    if n_clicks == 0:
        return ''
    return html.Div([
        html.Div([
            dcc.Input(
                value='Input {}'.format(i),
                id='input-{}'.format(i)
            )
            for i in range(10)
        ]),
        html.Div(id='dynamic-output')
    ]) 
开发者ID:plotly,项目名称:dash-recipes,代码行数:16,代码来源:generate_callbacks.py

示例9: display_output

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def display_output(value):
    if value == 'Hide':
        return ''
    return html.Div([
        html.Div([
            dcc.Input(value='Input {}'.format(i), id='input-{}'.format(i))
            for i in range(10)
        ]),
        html.Div(id='dynamic-output')
    ]) 
开发者ID:plotly,项目名称:dash-recipes,代码行数:12,代码来源:dash-dynamic-outputs.py

示例10: plugin_data_requested

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def plugin_data_requested(self) -> Input:
        return Input(self._plugin_wrapper_id, "data_requested") 
开发者ID:equinor,项目名称:webviz-config,代码行数:4,代码来源:_plugin_abc.py

示例11: container_data_requested

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def container_data_requested(self) -> Input:
        warnings.warn(
            ("Use 'plugin_data_requested' instead of 'container_data_requested'"),
            DeprecationWarning,
        )
        return self.plugin_data_requested 
开发者ID:equinor,项目名称:webviz-config,代码行数:8,代码来源:_plugin_abc.py

示例12: plot_input_callbacks

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def plot_input_callbacks(self) -> List[Input]:
        """Creates list of input dependencies for callback
        The inputs are the plot type and the current value
        for each plot option
        """
        inputs = []
        inputs.append(Input(self.uuid("plottype"), "value"))
        for plot_arg in self.plot_args.keys():
            inputs.append(Input(self.uuid(f"dropdown-{plot_arg}"), "value"))
        for filtcol in self.filter_cols:
            inputs.append(Input(self.uuid(f"filter-{filtcol}"), "value"))
        return inputs 
开发者ID:equinor,项目名称:webviz-config,代码行数:14,代码来源:_table_plotter.py

示例13: set_callbacks

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [as 别名]
def set_callbacks(self, app: Dash) -> None:
        @app.callback(
            Output(self.uuid("output-state"), "children"),
            [Input(self.uuid("submit-button"), "n_clicks")],
        )
        def _update_output(n_clicks: int) -> str:
            return f"Button has been pressed {n_clicks} times." 
开发者ID:equinor,项目名称:webviz-config,代码行数:9,代码来源:_example_plugin.py

示例14: test_flat_button

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [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') 
开发者ID:StratoDem,项目名称:sd-material-ui,代码行数:30,代码来源:test_integration.py

示例15: test_raised_button

# 需要导入模块: from dash import dependencies [as 别名]
# 或者: from dash.dependencies import Input [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') 
开发者ID:StratoDem,项目名称:sd-material-ui,代码行数:30,代码来源:test_integration.py


注:本文中的dash.dependencies.Input方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。