How to use the ipywidgets.IntSlider 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 vaexio / vaex / packages / vaex-jupyter / vaex / jupyter / viz.py View on Github external
self.viz = viz
            self.ds = self.viz.state.ds
            column_names = self.ds.get_column_names()

            self.x = v.Select(items=column_names, v_model=self.viz.state.x_expression, label='x axis')
            widgets.link((self.viz.state, 'x_expression'), (self.x, 'v_model'))

            self.normalize = v.Checkbox(v_model=self.viz.normalize, label='normalize')
            widgets.link((self.viz, 'normalize'), (self.normalize, 'v_model'))

            self.min = widgets.FloatText(description='min')
            self.max = widgets.FloatText(description='max')
            widgets.link((self.viz.state, 'x_min'), (self.min, 'value'))
            widgets.link((self.viz.state, 'x_max'), (self.max, 'value'))
            
            self.shape = widgets.IntSlider(min=1, max=512, value=64, description='bins')
            widgets.link((self.viz.state, 'shape'), (self.shape, 'value'))

            self.bar_style = widgets.ToggleButtons(options=[('Stacked', 'stacked'), ('Grouped', 'grouped')], description='Bar style')
            widgets.link((self.viz. bar, 'type'), (self.bar_style, 'value'))

            self.children = [self.x, self.normalize, self.min, self.max, self.shape, self.bar_style]
github exa-analytics / exatomic / exatomic / widgets / widget.py View on Github external
def _contour_folder(self, folder):
        control = Button(description=' Contours', icon='dot-circle-o')
        def _cshow(b):
            for scn in self.active(): scn.cont_show = not scn.cont_show
        control.on_click(_cshow)
        content = _ListDict([
            ('fopts', folder['fopts']),
            ('axis', Dropdown(options=['x', 'y', 'z'], value='z')),
            ('num', IntSlider(description='N', min=5, max=20,
                              value=10, step=1)),
            ('lim', IntRangeSlider(description='10**Limits', min=-8,
                                   max=0, step=1, value=[-7, -1])),
            ('val', FloatSlider(description='Value',
                                min=-5, max=5, value=0))])
        def _cont_axis(c):
            for scn in self.active(): scn.cont_axis = c.new
        def _cont_num(c):
            for scn in self.active(): scn.cont_num = c.new
        def _cont_lim(c):
            for scn in self.active(): scn.cont_lim = c.new
        def _cont_val(c):
            for scn in self.active(): scn.cont_val = c.new
        content['axis'].observe(_cont_axis, names='value')
        content['num'].observe(_cont_num, names='value')
        content['lim'].observe(_cont_lim, names='value')
github flatironinstitute / CaImAn / nb_interface / src / cnmf_results_widgets.py View on Github external
#for i in range(len(children)):
#    tab.set_title(i, str(i))
#tab

view_cnmf_results_widget = widgets.Button(
	description='View/Refine CNMF Results',
	disabled=False,
	button_style='info', # 'success', 'info', 'warning', 'danger' or ''
	tooltip='View CNMF Results',
	layout=widgets.Layout(width="30%")
)

##### Validation Tab: ######
############################

validate_col_mag_slider = widgets.IntSlider(
	value=2,
	min=1,
	max=10,
	step=1,
	#description='Movie Magnification:',
	disabled=False,
	continuous_update=False,
	orientation='horizontal',
	readout=True,
	readout_format='d',
	tooltip='How much to magnify the movie',
	layout=widgets.Layout(width="30%")
)
validate_col_mag_box = widgets.HBox([widgets.Label("Movie Magnification:"), validate_col_mag_slider])

validate_col_cnmf_mov_btn = widgets.Button(
github rwnobrega / komm / demo / binary_sequences.py View on Github external
# In[3]:


def walsh_hadamard_demo(length, ordering, index):
    walsh_hadamard = komm.WalshHadamardSequence(length=length, ordering=ordering, index=index)
    ax = plt.axes()
    ax.stem(np.arange(length), walsh_hadamard.polar_sequence)
    ax.set_title(repr(walsh_hadamard))
    ax.set_xlabel('$n$')
    ax.set_ylabel('$a[n]$')
    ax.set_yticks([-1, 0, 1])
    ax.set_ylim([-1.2, 1.2])
    plt.show()

length_widget = ipywidgets.SelectionSlider(options=[2**i for i in range(1, 8)])
index_widget = ipywidgets.IntSlider(min=0, max=1, step=1, value=0)

def update_index_widget(*args):
    index_widget.max = length_widget.value - 1
length_widget.observe(update_index_widget, 'value')

ipywidgets.interact(walsh_hadamard_demo, length=length_widget, ordering=['natural', 'sequency'], index=index_widget);


# ## Linear-feedback shift register (LFSR) sequence -- Maximum-length sequence (MLS)

# In[4]:


def lfsr_demo(degree):
    lfsr = komm.LFSRSequence.maximum_length_sequence(degree=degree)
    length = lfsr.length
github zhouyanasd / DL-NC / Brian2_scripts / sim_brian_scratch / sim_brian_KHT / sim_brian_KTH_v1_BO_v3.py View on Github external
fig = Figure(marks=[line], axes=[xax, yax], animation_duration=a_duration)

        def on_value_change(change):
            line.x = t[change['new']:interval + change['new']]
            line.y = v[:, change['new']:interval + change['new']]

        play = widgets.Play(
            interval=a_interval,
            value=0,
            min=0,
            max=duration,
            step=a_step,
            description="Press play",
            disabled=False
        )
        slider = widgets.IntSlider(min=0, max=duration)
        widgets.jslink((play, 'value'), (slider, 'value'))
        slider.observe(on_value_change, names='value')
        return play, slider, fig
github HCsoft-RD / shaolin / shaolin / core / object_notation.py View on Github external
def word_to_num_widget(word, kwargs):
    int_types = (int, np.int, np.int16, np.int0, np.int8,
                 np.int32, np.int64)
    float_types = (np.float, np.float128, np.float16,
                   np.float32, np.float64, float)
    if isinstance(word, int_types):
        if 'value' not in kwargs.keys():
            kwargs['value'] = word
        if 'max' not in kwargs.keys():
            kwargs['max'] = word + 100
        if 'min' not in kwargs.keys():
            kwargs['min'] = word -100
                  
        return Widget(wid.IntSlider, **kwargs)
    elif isinstance(word, float_types):
        if 'value' not in kwargs.keys():
            kwargs['value'] = word
        if 'max' not in kwargs.keys():
            kwargs['max'] = word + 100.
        if 'min' not in kwargs.keys():
            kwargs['min'] = word -100.
        return Widget(wid.FloatSlider, **kwargs)

    elif isinstance(word, tuple):
        is_int = np.all([isinstance(w, int_types) for w in word])
        if is_int:
            return Widget(wid.IntSlider, **kwargs)
        else:
             return Widget(wid.FloatSlider, **kwargs)
    else:
github geoscixyz / em_examples / em_examples / DC_Pseudosections.py View on Github external
ntx, nmax = xr.size-2, 8
        dxr = np.diff(xr)
    elif flag == "DipolePole":
        ntx, nmax = xr.size-1, 7
        dxr = xr
    elif flag == "DipoleDipole":
        ntx, nmax = xr.size-3, 8
        dxr = np.diff(xr)
    elif flag == "PolePole":
        ntx, nmax = xr.size-2, 8
        dxr = xr
    xzlocs = getPseudoLocs(dxr, ntx, nmax, flag)
    PseudoSectionPlot = lambda i, j: PseudoSectionPlotfnc(i, j, survey, flag)
    return widgetify(
        PseudoSectionPlot,
        i=IntSlider(min=0, max=ntx-1, step=1, value=0),
        j=IntSlider(min=0, max=nmax-1, step=1, value=0))
github zhouyanasd / DL-NC / Brian2_scripts / sim_brian_scratch / sim_brian_MNIST / sim_brian_MNIST_v5.py View on Github external
fig = Figure(marks=[line], axes=[xax, yax], animation_duration=a_duration)

    def on_value_change(change):
        line.x = t[change['new']:interval+change['new']]
        line.y = v[:,change['new']:interval+change['new']]

    play = widgets.Play(
        interval=a_interval,
        value=0,
        min=0,
        max=duration,
        step=a_step,
        description="Press play",
        disabled=False
    )
    slider = widgets.IntSlider(min=0, max=duration)
    widgets.jslink((play, 'value'), (slider, 'value'))
    slider.observe(on_value_change, names='value')
    return play, slider, fig
github Jupyter-Kale / kale / kale / examples / graphene / graphene_widget.py View on Github external
min=maxbounds[2][0], 
            max=maxbounds[2][1], 
            description='z',
            layout=slider_layout,
            style=slider_style
        )
        
        self._procs_label = ipw.Label("Processor Grid")
        self._x_procs_slider = ipw.IntSlider(
            min=1, 
            max=maxprocs, 
            description='x',
            layout=slider_layout,
            style=slider_style
        )
        self._y_procs_slider = ipw.IntSlider(
            min=1, 
            max=maxprocs, 
            description='y',
            layout=slider_layout,
            style=slider_style
        )
        self._z_procs_slider = ipw.IntSlider(
            min=1, 
            max=maxprocs, 
            description='z',
            layout=slider_layout,
            style=slider_style
        )
        
        self._nsteps_label = ipw.Label("Number of Timesteps")
        self._nsteps = ipw.BoundedIntText(min=1, max=maxsteps, value=10000)