Python dash_core_components.Input() Examples

The following are 19 code examples of dash_core_components.Input(). 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_core_components , or try the search function .
Example #1
Source File: plotly_apps.py    From django-plotly-dash with MIT License 7 votes vote down vote up
def generate_liveOut_layout():
    'Generate the layout per-app, generating each tine a new uuid for the state_uid argument'
    return html.Div([
        dpd.Pipe(id="named_count_pipe",
                 value=None,
                 label="named_counts",
                 channel_name="live_button_counter"),
        html.Div(id="internal_state",
                 children="No state has been computed yet",
                 style={'display':'none'}),
        dcc.Graph(id="timeseries_plot"),
        dcc.Input(value=str(uuid.uuid4()),
                  id="state_uid",
                  style={'display':'none'},
                 )
        ]) 
Example #2
Source File: dash-dynamic-table-created-without-id.py    From dash-recipes with MIT License 7 votes vote down vote up
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')
    ]) 
Example #3
Source File: layout.py    From dtale with GNU Lesser General Public License v2.1 6 votes vote down vote up
def build_mapbox_token_children():
    from dtale.charts.utils import get_mapbox_token

    msg = "To access additional styles enter a token here..."
    if get_mapbox_token() is None:
        msg = "Change your token here..."
    return [
        html.I(className="ico-help-outline", style=dict(color="white")),
        html.Div(
            [
                html.Span("Mapbox Access Token:"),
                dcc.Input(
                    id="mapbox-token-input",
                    type="text",
                    placeholder=msg,
                    className="form-control",
                    value="",
                    style={"lineHeight": "inherit"},
                ),
            ],
            className="hoverable__content",
            style=dict(width="20em", right="-1.45em"),
        ),
    ] 
Example #4
Source File: main.py    From deep_architect with MIT License 5 votes vote down vote up
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. 
Example #5
Source File: dash_reusable_components.py    From dash-cytoscape with MIT License 5 votes vote down vote up
def NamedInput(name, **kwargs):
    return html.Div(
        children=[
            html.P(children=f'{name}:'),
            dcc.Input(**kwargs)
        ]
    )


# Utils 
Example #6
Source File: plotly_apps.py    From django-plotly-dash with MIT License 5 votes vote down vote up
def callback_liveIn_button_press(red_clicks, blue_clicks, green_clicks,
                                 rc_timestamp, bc_timestamp, gc_timestamp, **kwargs): # pylint: disable=unused-argument
    'Input app button pressed, so do something interesting'

    if not rc_timestamp:
        rc_timestamp = 0
    if not bc_timestamp:
        bc_timestamp = 0
    if not gc_timestamp:
        gc_timestamp = 0

    if (rc_timestamp + bc_timestamp + gc_timestamp) < 1:
        change_col = None
        timestamp = 0
    else:
        if rc_timestamp > bc_timestamp:
            change_col = "red"
            timestamp = rc_timestamp
        else:
            change_col = "blue"
            timestamp = bc_timestamp

        if gc_timestamp > timestamp:
            timestamp = gc_timestamp
            change_col = "green"

        value = {'red_clicks':red_clicks,
                 'blue_clicks':blue_clicks,
                 'green_clicks':green_clicks,
                 'click_colour':change_col,
                 'click_timestamp':timestamp,
                 'user':str(kwargs.get('user', 'UNKNOWN'))}

        send_to_pipe_channel(channel_name="live_button_counter",
                             label="named_counts",
                             value=value)
    return "Number of local clicks so far is %s red and %s blue; last change is %s at %s" % (red_clicks,
                                                                                             blue_clicks,
                                                                                             change_col,
                                                                                             datetime.fromtimestamp(0.001*timestamp)) 
Example #7
Source File: basic-input.py    From dash-docs with MIT License 5 votes vote down vote up
def update_output(input1, input2):
    return u'Input 1 is "{}" and Input 2 is "{}"'.format(input1, input2) 
Example #8
Source File: basic-state.py    From dash-docs with MIT License 5 votes vote down vote up
def update_output(n_clicks, input1, input2):
    return u'''
        The Button has been pressed {} times,
        Input 1 is "{}",
        and Input 2 is "{}"
    '''.format(n_clicks, input1, input2) 
Example #9
Source File: common_features.py    From dash-bio with MIT License 5 votes vote down vote up
def user_interactions_callback(
        app,
        dash_duo,
        component_id,
        prop_name
):
    @app.callback(
        dash.dependencies.Output('interaction-results', 'children'),
        [Input(component_id, prop_name)]
    )
    def update_interaction_info(result):
        return json.dumps(result)

    dash_duo.start_server(app)
    dash_duo.wait_for_element('#' + component_id) 
Example #10
Source File: common_features.py    From dash-bio with MIT License 5 votes vote down vote up
def nested_component_layout(
        component
):
    return [
        dcc.Input(id='prop-name'),
        dcc.Input(id='prop-value'),
        html.Div(id='pass-fail-div'),
        html.Button('Submit', id='submit-prop-button'),
        dcc.Graph(
            id='test-graph',
            figure=component
        )
    ] 
Example #11
Source File: common_features.py    From dash-bio with MIT License 5 votes vote down vote up
def simple_app_layout(
        component
):
    return [
        dcc.Input(id='prop-name'),
        dcc.Input(id='prop-value'),
        html.Div(id='pass-fail-div'),
        html.Button('Submit', id='submit-prop-button'),
        component
    ] 
Example #12
Source File: _well_cross_section.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def well_options(self):
        return html.Div(
            style={"marginLeft": "20px", "marginRight": "0px", "marginBotton": "0px"},
            children=[
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Sampling:", style={"font-weight": "bold"}),
                            dcc.Input(
                                id=self.ids("sampling"),
                                debounce=True,
                                type="number",
                                value=self.sampling,
                            ),
                        ]
                    )
                ),
                html.Div(
                    children=html.Label(
                        children=[
                            html.Span("Nextend:", style={"font-weight": "bold"}),
                            dcc.Input(
                                id=self.ids("nextend"),
                                debounce=True,
                                type="number",
                                value=self.nextend,
                            ),
                        ]
                    )
                ),
            ],
        ) 
Example #13
Source File: _well_cross_section_fmu.py    From webviz-subsurface with GNU General Public License v3.0 5 votes vote down vote up
def intersection_option(self):
        options = [
            {"label": "Keep zoom state", "value": "keep_zoom_state"},
            {"label": "Show surface fill", "value": "show_surface_fill"},
        ]
        value = ["show_surface_fill"]
        if self.segyfiles:
            options.append({"label": "Show seismic", "value": "show_seismic"})
        if self.zonelog is not None:
            options.append({"label": "Show zonelog", "value": "show_zonelog"})
            value.append("show_zonelog")

        return html.Div(
            style=self.set_style(marginTop="20px"),
            children=[
                html.Label("Intersection settings", style={"font-weight": "bold"}),
                html.Label("Sampling"),
                dcc.Input(
                    id=self.ids("sampling"),
                    debounce=True,
                    type="number",
                    value=self.sampling,
                ),
                html.Label("Extension"),
                dcc.Input(
                    id=self.ids("nextend"),
                    debounce=True,
                    type="number",
                    value=self.nextend,
                ),
                dcc.Checklist(id=self.ids("options"), options=options, value=value),
            ],
        ) 
Example #14
Source File: dash-dynamic-outputs.py    From dash-recipes with MIT License 5 votes vote down vote up
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')
    ]) 
Example #15
Source File: generate_callbacks.py    From dash-recipes with MIT License 5 votes vote down vote up
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')
    ]) 
Example #16
Source File: main.py    From deep_architect with MIT License 5 votes vote down vote up
def get_input(self, attribute_name):
        return Input(self.full_name, attribute_name) 
Example #17
Source File: common_features.py    From dash-bio with MIT License 4 votes vote down vote up
def simple_app_callback(
        app,
        dash_duo,
        component_id,
        test_prop_name,
        test_prop_value,
        prop_value_type,
        validation_fn=None,
        take_snapshot=False
):
    if validation_fn is None:
        def validation_fn(x): return x == test_prop_value

    @app.callback(
        Output(component_id, test_prop_name),
        [Input('submit-prop-button', 'n_clicks')],
        [State('prop-value', 'value')]
    )
    def setup_click_callback(nclicks, value):
        if nclicks is not None and nclicks > 0:
            return process_value(value, prop_value_type)
        raise dash.exceptions.PreventUpdate()

    @app.callback(
        Output('pass-fail-div', 'children'),
        [Input(component_id, test_prop_name)],
        [State('submit-prop-button', 'n_clicks')]
    )
    def simple_callback(prop_value, nclicks):
        if nclicks is None or nclicks == 0:
            return None
        passfail = PASS if validation_fn(prop_value) else FAIL
        return html.Div(passfail, id='passfail')

    _start_app_server(
        app,
        dash_duo,
        component_id,
        test_prop_name,
        test_prop_value,
        take_snapshot
    ) 
Example #18
Source File: app.py    From dash-bio with MIT License 4 votes vote down vote up
def chromosome_div(
        id_tag='chr',
        name_tag='Chr',
        startone=0,
        stopone=1,
        starttwo=0,
        stoptwo=1
):
    return html.Div(
        [
            html.Div(className='app-controls-block', children=[
                html.Div(className='app-controls-name', children='%s Start-one' % name_tag),
                dcc.Input(
                    id='%s-startone' % id_tag,
                    placeholder='%s StartOne',
                    type='number',
                    value=startone,
                    className='ideogram-homology-inputs',
                )
            ]),
            html.Div(className='app-controls-block', children=[
                html.Div(className='app-controls-name', children='%s Stop-one' % name_tag),
                dcc.Input(
                    id='%s-stopone' % id_tag,
                    placeholder='Enter chromosomes',
                    type='number',
                    value=stopone,
                    className='ideogram-homology-inputs',
                )
            ]),
            html.Div(className='app-controls-block', children=[
                html.Div(className='app-controls-name', children='%s Start-two' % name_tag),
                dcc.Input(
                    id='%s-starttwo' % id_tag,
                    placeholder='%s Starttwo' % name_tag,
                    type='number',
                    value=starttwo,
                    className='ideogram-homology-inputs',
                )
            ]),
            html.Div(className='app-controls-block', children=[
                html.Div(className='app-controls-name', children='%s Stop-two' % name_tag),
                dcc.Input(
                    id='%s-stoptwo' % id_tag,
                    placeholder='Enter chromsomes',
                    type='number',
                    value=stoptwo,
                    className='ideogram-homology-inputs',
                )
            ])
        ]
    ) 
Example #19
Source File: input-basic.py    From dash-docs with MIT License 4 votes vote down vote up
def update_output(input1, input2):
    return u'Input 1 {} and Input 2 {}'.format(input1, input2)