How to use the ipywidgets.ToggleButtons 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 / bqplot.py View on Github external
self.button_reset.on_click(reset)

            self.button_select_nothing.on_click(lambda *ignore: self.plot.select_nothing())
            self.tools.append(self.button_select_nothing)
            self.modes_names = "replace and or xor subtract".split()
            self.modes_labels = "replace and or xor subtract".split()
            self.button_selection_mode = widgets.Dropdown(description='select', options=self.modes_labels)
            self.tools.append(self.button_selection_mode)

            def change_interact(*args):
                # print "change", args
                self.figure.interaction = tool_actions_map[self.button_action.value]

            tool_actions = ["pan/zoom", "select"]
            # tool_actions = [("m", "m"), ("b", "b")]
            self.button_action = widgets.ToggleButtons(description='', options=[(action, action) for action in tool_actions],
                                                       icons=["arrows", "pencil-square-o"])
            self.button_action.observe(change_interact, "value")
            self.tools.insert(0, self.button_action)
            self.button_action.value = "pan/zoom"  # tool_actions[-1]
            if len(self.tools) == 1:
                tools = []
            # self._main_widget_1.children += (self.button_reset,)
            self._main_widget_1.children += (self.button_action,)
            self._main_widget_1.children += (self.button_select_nothing,)
            # self._main_widget_2.children += (self.button_selection_mode,)
        self._main_widget.children = [self._main_widget_1, self._main_widget_2]
        self.control_widget.children += (self._main_widget,)
        self._update_grid_counter = 0  # keep track of t
        self._update_grid_counter_scheduled = 0  # keep track of t
github asvcode / Vision_UI / vision_ui.py View on Github external
def cm_values():
    cm_values.color = widgets.ToggleButtons(
        options=['none','magma', 'viridis', 'seismic', 'gist_rainbow', 'gnuplot', 'hsv_r', 'hsv'],
        description='Colormap:',
        disabled=False,
        button_style='success', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[],
    )

    cm_values.inter = widgets.ToggleButtons(
        options=['nearest', 'bilinear', 'bicubic', 'gaussian'],
        description='Interpolation:',
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[],
    )

    layout = {'width':'90%', 'height': '50px', 'border': 'solid', 'fontcolor':'lightgreen'}
    style_green = {'handle_color': 'green', 'readout_color': 'red', 'slider_color': 'blue'}
    cm_values.f=widgets.FloatSlider(min=0,max=2,step=0.1,value=0.4, continuous_update=False, layout=layout, style=style_green, description="Alpha")

    display(cm_values.color, cm_values.inter, cm_values.f)

    confusion()
github asvcode / Vision_UI / vision_ui.py View on Github external
def data_in():
    """Helper to determine if the data is in a folder, csv or dataframe"""
    style = {'description_width': 'initial'}

    button = widgets.Button(description='Data In')

    data_in.datain = widgets.ToggleButtons(
        options=['from_folder', 'from_csv'],
        description='Data In:',
        value=None,
        disabled=False,
        button_style='success',
        tooltips=['Data in folder', 'Data in csv format'],
    )
    display(data_in.datain)

    display(button)

    disp_out = widgets.Output()
    display(disp_out)

    def on_choice_button(b):
        with disp_out:
github asvcode / Vision_UI / vision_ui2.py View on Github external
def dashboard_two():
    """GUI for second accordion window"""
    dashboard_two.datas = widgets.ToggleButtons(
        options=['PETS', 'CIFAR', 'IMAGENETTE_160', 'IMAGEWOOF_160', 'MNIST_TINY'],
        description='Choose',
        value=None,
        disabled=False,
        button_style='info',
        tooltips=[''],
        style=style
    )

    display(dashboard_two.datas)

    button = widgets.Button(description='Explore', button_style='success')
    display(button)
    out = widgets.Output()
    display(out)
    def on_button_explore(b):
github geoscixyz / em_examples / em_examples / DCWidget.py View on Github external
def cylinder_app():
    f = cylinder_wrapper
    app = interactive(f,
            rhohalf = FloatSlider(min=10.,max=1000.,step=10., value = 500., continuous_update=False),
            rhocyl = FloatSlider(min=10.,max=1000.,step=10., value = 500., continuous_update=False),
            r = FloatSlider(min=1.,max=20.,step=1.,value=10., continuous_update=False),
            A = FloatSlider(min=-40.,max=40.,step=1.,value=-30., continuous_update=False),
            B = FloatSlider(min=-40.,max=40.,step=1.,value=30., continuous_update=False),
            Field = ToggleButtons(options =['Model','Potential','E','J','Charge'],value='Model'),
            Type = ToggleButtons(options =['Total','Primary','Secondary'],value='Total')
            #Scale = ToggleButtons(options = ['Scalar','Log'],value='Scalar')
            )
    w = VBox(app.children)
    f.widget = w
    defaults=dict([(child.description, child.value) for child in app.children])
    iplot.on_displayed(f(**defaults))
    return w
github asvcode / Vision_UI / vision_ui.py View on Github external
options=['Yes', 'No'],
        description='Error Choice:',
        value='No',
        disabled=False,
        button_style='success', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.accuracy = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Accuracy:',
        value='No',
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.accuracy_thresh = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Accuracy Threshs:',
        value='No',
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.topk = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Top K:',
        value='No',
        disabled=False,
        button_style='warning', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.recall = widgets.ToggleButtons(
github asvcode / Vision_UI / paperspace_ui.py View on Github external
options=['Yes', 'No'],
        description='Error Choice:',
        value='No',
        disabled=False,
        button_style='success', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.accuracy = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Accuracy:',
        value='No',
        disabled=False,
        button_style='info', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.topk = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Top K:',
        value='No',
        disabled=False,
        button_style='warning', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.recall = widgets.ToggleButtons(
        options=['Yes', 'No'],
        description='Recall:',
        value='No',
        disabled=False,
        button_style='success', # 'success', 'info', 'warning', 'danger' or ''
        tooltips=[''],
    )
    metrics_dashboard.precision = widgets.ToggleButtons(
github glue-viz / glue-jupyter / glue_jupyter / ipyvolume / scatter / layer_style_widget.py View on Github external
def __init__(self, layer_state):

        self.state = layer_state

        self.widget_visible = Checkbox(description='visible', value=self.state.visible)
        link((self.state, 'visible'), (self.widget_visible, 'value'))

        self.widget_marker = ToggleButtons(options=['sphere', 'box', 'diamond', 'circle_2d'])
        link((self.state, 'geo'), (self.widget_marker, 'value'))

        self.widget_size = Size(state=self.state)
        self.widget_color = Color(state=self.state)

        # vector/quivers
        self.widget_vector = Checkbox(description='show vectors', value=self.state.vector_visible)

        self.widget_vector_x = LinkedDropdown(self.state, 'vx_att', label='vx')
        self.widget_vector_y = LinkedDropdown(self.state, 'vy_att', label='vy')
        self.widget_vector_z = LinkedDropdown(self.state, 'vz_att', label='vz')

        link((self.state, 'vector_visible'), (self.widget_vector, 'value'))
        dlink((self.widget_vector, 'value'), (self.widget_vector_x.layout, 'display'),
              lambda value: None if value else 'none')
        dlink((self.widget_vector, 'value'), (self.widget_vector_y.layout, 'display'),
github geoscixyz / em_examples / em_examples / DC_cylinder.py View on Github external
min=1e-8, max=1e8, value=500., continuous_update=False, description='$\\rho_1$'),
                    r=FloatSlider(min=1., max=20., step=1.,
                                  value=10., continuous_update=False),
                    xc=FloatSlider(min=-20., max=20., step=1.,
                                   value=0., continuous_update=False),
                    zc=FloatSlider(min=-20., max=0., step=1.,
                                   value=-30., continuous_update=False),
                    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 flatironinstitute / CaImAn / nb_interface / cnmf_widgets.py View on Github external
tooltip='Inspect Correlation Plot',
	layout=widgets.Layout(width="30%")
)

cnmf_file_selector = widgets.Text(
	value=os.getcwd(),
	placeholder=os.getcwd(),
	description='File (.mmap):',
	layout=widgets.Layout(width='50%'),
	disabled=False
)


######

is_patches_widget = widgets.ToggleButtons(
	value='Single FOV',
	options=['Patches', 'Single FOV'],
	description='Patches?:',
	disabled=False,
	button_style='', # 'success', 'info', 'warning', 'danger' or ''
	tooltips=['Run each frame in parallel by breaking into overlapping FOVs', 'The whole frame is analyed as a single FOV'],
#     icons=['check'] * 3
)
dslabel = widgets.Label(value="Downsample Percentage (spatial, temporal)")

ds_spatial_widget = widgets.BoundedFloatText(
	value=1.0,
	min=0.0,
	max=1.0,
	step=0.1,
	description='spatial:',