當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。