How to use the ipywidgets.FloatSlider function in ipywidgets

To help you get started, we’ve selected a few ipywidgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geoscixyz / em_examples / em_examples / DCWidgetResLayer2D.py View on Github external
min=1e-8, max=1e8, value=5000., continuous_update=False, description='$\\rho_{2}$'),
                    xc=FloatSlider(min=-30., max=30., step=1.,
                                   value=0., continuous_update=False),
                    zc=FloatSlider(min=-30., max=-15., step=0.5,
                                   value=-25., continuous_update=False),
                    r=FloatSlider(min=1., max=10., step=0.5,
                                  value=5., continuous_update=False),
                    rhoHalf=FloatText(
                        min=1e-8, max=1e8, value=500., continuous_update=False, description='$\\rho_{1}$'),
                    rhoTarget=FloatText(
                        min=1e-8, max=1e8, value=500., continuous_update=False, description='$\\rho_{3}$'),
                    A=FloatSlider(min=-30.25, max=30.25, step=0.5,
                                  value=-30.25, continuous_update=False),
                    B=FloatSlider(min=-30.25, max=30.25, step=0.5,
                                  value=30.25, continuous_update=False),
                    M=FloatSlider(min=-30.25, max=30.25, step=0.5,
                                  value=-10.25, continuous_update=False),
                    N=FloatSlider(min=-30.25, max=30.25, step=0.5,
                                  value=10.25, continuous_update=False),
                    Field=ToggleButtons(
                        options=['Model', 'Potential', 'E', 'J', 'Charge', 'Sensitivity'], value='Model'),
                    Type=ToggleButtons(
                        options=['Total', 'Primary', 'Secondary'], value='Total'),
                    Scale=ToggleButtons(
                        options=['Linear', 'Log'], value='Linear')
                    )
    return app
github bernhard-42 / jupyter-cadquery / jupyter_cadquery / cad_display.py View on Github external
def slider(self, value, min, max, step, description):
        label = Label(description)
        self.labels.append(label)
        ind = len(self.normals)
        button = ImageButton(
            width=36,
            height=28,
            image_path="%s/plane.png" % (self.image_path),
            tooltip="Set clipping plane",
            type=str(ind),
            layout=Layout(margin="0px 10px 0px 0px"))
        button.on_click(self.handler)
        button.add_class("view_button")

        slider = FloatSlider(
            value=value,
            min=min,
            max=max,
            step=step,
            description="",
            disabled=False,
            continuous_update=False,
            orientation='horizontal',
            readout=True,
            readout_format='.2f',
            layout=Layout(width="%dpx" % (self.width - 20)))

        slider.observe(self.cq_view.clip(ind), "value")
        return [HBox([button, label]), slider]
github asvcode / Vision_UI / vision_ui2.py View on Github external
aug.b_max = FloatSlider(min=0,max=10,step=1,value=0, description='max count',
                                     orientation='horizontal', disabled=True)
            aug.b_pval = FloatSlider(min=0,max=1,step=0.1,value=0, description='p',
                                     orientation='horizontal', disabled=True)
            aug.b_asp = FloatSlider(min=0.1,max=1.7,value=0.3, description='aspect',
                                     orientation='horizontal', disabled=True)
            aug.b_len = FloatSlider(min=0.1,max=1.7,value=0.3, description='length',
                                     orientation='horizontal', disabled=True)
            aug.b_ht = FloatSlider(min=0.1,max=1.7,value=0.3, description='height',
                                     orientation='horizontal', disabled=True)
            aug.erase_code = 'this is ERASE OFF'
    #Contrast
    if aug_paras.cc.value == True:
            aug.b1_max = FloatSlider(min=0,max=0.9,step=0.1,value=0.2, description='max light',
                                  orientation='horizontal', disabled=False)
            aug.b1_pval = FloatSlider(min=0,max=1.0,step=0.05,value=0.75, description='p',
                                  orientation='horizontal', disabled=False)
            aug.b1_draw = FloatSlider(min=0,max=100,step=1,value=1, description='draw',
                                  orientation='horizontal', disabled=False)
    else:
            aug.b1_max = FloatSlider(min=0,max=0.9,step=0.1,value=0, description='max light',
                                  orientation='horizontal', disabled=True)
            aug.b1_pval = FloatSlider(min=0,max=1.0,step=0.05,value=0.75, description='p',
                                  orientation='horizontal', disabled=True)
            aug.b1_draw = FloatSlider(min=0,max=100,step=1,value=1, description='draw',
                                  orientation='horizontal', disabled=True)
    #Rotate
    if aug_paras.dd.value == True:
            aug.b2_max = FloatSlider(min=0,max=10,step=1,value=0, description='max degree',
                                  orientation='horizontal', disabled=False)
            aug.b2_pval = FloatSlider(min=0,max=1,step=0.1,value=0.5, description='p',
                                  orientation='horizontal', disabled=False)
github megbedell / wobble / paper / figures / HD189733 / viz.py View on Github external
widgets.FloatSlider(
    value=0.0,
    min=-1.0,
    max=1.0,
    step=0.01,
    description=r'$u_2$:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='.2f',
    layout=Layout(width='40%')
)

yslider = \
widgets.FloatSlider(
    value=0,
    min=-1.0,
    max=1.0,
    step=0.01,
    description=r'$b$:',
    disabled=False,
    continuous_update=False,
    orientation='horizontal',
    readout=True,
    readout_format='.2f',
    layout=Layout(width='40%')
)

rslider = \
widgets.FloatSlider(
    value=0.1,
github asvcode / Vision_UI / colab_ui.py View on Github external
def training():
    print('>> Using fit_one_cycle')
    button = widgets.Button(description='Train')

    style = {'description_width': 'initial'}

    layout = {'width':'90%', 'height': '50px', 'border': 'solid', 'fontcolor':'lightgreen'}
    layout_two = {'width':'100%', 'height': '200px', 'border': 'solid', 'fontcolor':'lightgreen'}
    style_green = {'handle_color': 'green', 'readout_color': 'red', 'slider_color': 'blue'}
    style_blue = {'handle_color': 'blue', 'readout_color': 'red', 'slider_color': 'blue'}

    training.cl=widgets.FloatSlider(min=1,max=64,step=1,value=1, continuous_update=False, layout=layout, style=style_green, description="Cycle Length")
    training.lr = widgets.ToggleButtons(
        options=['1e-6', '1e-5', '1e-4', '1e-3', '1e-2', '1e-1'],
        description='Learning Rate:',
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        style=style,
        value='1e-2',
        tooltips=['Choose a suitable learning rate'],
    )

    display(training.cl, training.lr)

    display(button)

    out = widgets.Output()
    display(out)
github hyperspy / hyperspy / hyperspy / gui_ipywidgets / axes.py View on Github external
size = ipywidgets.IntText(disabled=True)
    widgets.append(labelme("Size", size))
    link((obj, "size"), (size, "value"))
    wd["size"] = size

    index_in_array = ipywidgets.IntText(disabled=True)
    widgets.append(labelme("Index in array", index_in_array))
    link((obj, "index_in_array"), (index_in_array, "value"))
    wd["index_in_array"] = index_in_array
    if obj.navigate:
        index = ipywidgets.IntSlider(min=0, max=obj.size - 1)
        widgets.append(labelme("Index", index))
        link((obj, "index"), (index, "value"))
        wd["index"] = index

        value = ipywidgets.FloatSlider(
            min=obj.low_value,
            max=obj.high_value,
        )
        wd["value"] = value
        widgets.append(labelme("Value", value))
        link((obj, "value"), (value, "value"))
        link((obj, "high_value"), (value, "max"))
        link((obj, "low_value"), (value, "min"))
        link((obj, "scale"), (value, "step"))

    units = ipywidgets.Text()
    widgets.append(labelme("Units", units))
    link((obj, "units"), (units, "value"))
    wd["units"] = units

    scale = ipywidgets.FloatText()
github hyperspy / hyperspy / hyperspy / gui_ipywidgets / tools.py View on Github external
@register_ipy_widget(toolkey="Signal1D.smooth_total_variation")
@add_display_arg
def smooth_tv_ipy(obj, **kwargs):
    wdict = {}
    smoothing_parameter = ipywidgets.FloatSlider(min=0.1, max=1000)
    smoothing_parameter_max = ipywidgets.FloatText(
        value=smoothing_parameter.max)
    color = ipywidgets.ColorPicker()
    close = ipywidgets.Button(
        description="Close",
        tooltip="Close widget and remove the smoothed line from the signal figure.")
    apply = ipywidgets.Button(
        description="Apply",
        tooltip="Perform the operation using the selected range.")
    link((obj, "smoothing_parameter"),
         (smoothing_parameter, "value"))
    link((smoothing_parameter_max, "value"),
         (smoothing_parameter, "max"))
    link((obj, "line_color_ipy"), (color, "value"))
    wdict["smoothing_parameter"] = smoothing_parameter
    wdict["smoothing_parameter_max"] = smoothing_parameter_max
github Jupyter-Kale / kale / kale / examples / graphene / graphene_widget.py View on Github external
loc_header = ipw.HBox(
            children=[ipw.HTML(
                "<strong>Location</strong>"
            )],
            layout=ipw.Layout(
                justify_content='flex-start'
            )
        )
        self._loc_x_slider = ipw.FloatSlider(
            min=self.loc_x_range[0], 
            max=self.loc_x_range[1], 
            description='x',
            style=slider_style,
            layout=slider_layout
        )
        self._loc_y_slider = ipw.FloatSlider(
            min=self.loc_y_range[0], 
            max=self.loc_y_range[1], 
            description='y',
            style=slider_style,
            layout=slider_layout
        )
        self._loc_z_slider = ipw.FloatSlider(
            min=self.loc_z_range[0], 
            max=self.loc_z_range[1], 
            description='z',
            style=slider_style,
            layout=slider_layout
        )
        
        num_header = ipw.HBox(
            children=[ipw.HTML(
github pyvista / pyvista / pyvista / plotting / ipy_tools.py View on Github external
stepx = step
            stepy = step
            stepz = step

        # Now set up the widgets
        xsl = widgets.FloatSlider(min=self.input_dataset.bounds[0]+stepx,
                            max=self.input_dataset.bounds[1]-stepx,
                            step=stepx,
                            value=x,
                            continuous_update=self.continuous_update)
        ysl = widgets.FloatSlider(min=self.input_dataset.bounds[2]+stepy,
                            max=self.input_dataset.bounds[3]-stepy,
                            step=stepy,
                            value=y,
                            continuous_update=self.continuous_update)
        zsl = widgets.FloatSlider(min=self.input_dataset.bounds[4]+stepz,
                            max=self.input_dataset.bounds[5]-stepz,
                            step=stepz,
                            value=z,
                            continuous_update=self.continuous_update)

        # Create/display the widgets
        return interact(update, x=xsl, y=ysl, z=zsl,
                        scalars=self._get_array_names())
github asvcode / Vision_UI / vision_ui.py View on Github external
def bright_choice():
    """Helper for brightness augmentations"""
    bright = dashboard_two.bright.value

    if bright == 'True':
        bright_choice.one = widgets.FloatSlider(min=0,max=1,step=0.1,value=0.1, description='b1', orientation='vertical', style=style_green)
        bright_choice.two = widgets.FloatSlider(min=0, max=1, step=0.1, value=0.1, description='b2', orientation='vertical', style=style_green)
        bright_choice.three = widgets.FloatSlider(min=0, max=1, step=0.1, value=0, description='p', orientation='vertical', style=style_green)

        ui = widgets.HBox([bright_choice.one, bright_choice.two, bright_choice.three])
        print('>> Brightness')
        display(ui)

    else:
        bright_choice.one = widgets.FloatSlider(value=0)
        bright_choice.two = widgets.FloatSlider(value=0)
        bright_choice.three = widgets.FloatSlider(value=0)