How to use the ipywidgets.Tab 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 convexengineering / gpkit / gpkit / interactive / widgets.py View on Github external
fns_of_sol.append(__defaultfn)

    def redo_plots(_):
        "Refreshes the plotfn"
        if fns_of_sol and fns_of_sol[-1].__name__ == "__defaultfn":
            fns_of_sol.pop()  # get rid of the old one!
        if sweep.value:
            append_plotfn()
        if not fns_of_sol:
            fns_of_sol.append(__defaultfntable)
        sl.value = sl.value*(1.000001)  # pylint: disable=undefined-loop-variable

    sweep.observe(redo_plots, "value")
    y_axes.on_submit(redo_plots)
    sliderboxes.insert(0, widgets.HBox(children=[sweep, boxlabel, y_axes]))
    tabs = widgets.Tab(children=[widgets.VBox(children=sliderboxes,
                                              padding="1.25ex")])

    tabs.set_title(0, 'Sliders')

    return tabs
github Qiskit / qiskit-terra / qiskit / tools / jupyter / backend_monitor.py View on Github external
Returns:
        Tab: A tab widget for history images.
    """
    year = widgets.Output(layout=widgets.Layout(display='flex-inline',
                                                align_items='center',
                                                min_height='400px'))

    month = widgets.Output(layout=widgets.Layout(display='flex-inline',
                                                 align_items='center',
                                                 min_height='400px'))

    week = widgets.Output(layout=widgets.Layout(display='flex-inline',
                                                align_items='center',
                                                min_height='400px'))

    tabs = widgets.Tab(layout=widgets.Layout(max_height='620px'))
    tabs.children = [year, month, week]
    tabs.set_title(0, 'Year')
    tabs.set_title(1, 'Month')
    tabs.set_title(2, 'Week')
    tabs.selected_index = 1

    _build_job_history(tabs, backend)
    return tabs
github menpo / menpowidgets / menpowidgets / menpofitwidgets / base.py View on Github external
image_is_masked=isinstance(aam.appearance_models[0].mean(),
                                   MaskedImage),
        render_function=render_function)
    landmark_options_wid = LandmarkOptionsWidget(
        group_keys=groups_keys, labels_keys=labels_keys,
        type='2D', render_function=render_function)
    renderer_options_wid = RendererOptionsWidget(
        options_tabs=['zoom_one', 'axes', 'numbering_matplotlib', 'legend'],
        labels=None, axes_x_limits=None, axes_y_limits=None,
        render_function=render_function)
    info_wid = TextPrintWidget(text_per_line=[''])
    save_figure_wid = SaveMatplotlibFigureOptionsWidget()

    # Group widgets
    model_parameters_wid = ipywidgets.HBox(
        [ipywidgets.Tab([shape_model_parameters_wid,
                         appearance_model_parameters_wid])])
    model_parameters_wid.children[0].set_title(0, 'Shape')
    model_parameters_wid.children[0].set_title(1, 'Appearance')
    tmp_children = [model_parameters_wid]
    if n_levels > 1:
        # Define function that updates options' widgets state
        def update_widgets(change):
            value = change['new']
            # Update shape model parameters
            shape_model_parameters_wid.set_widget_state(
                n_shape_parameters[value], params_str='Parameter ',
                allow_callback=False)

            # Update appearance model parameters
            appearance_model_parameters_wid.set_widget_state(
                n_appearance_parameters[value], params_str='Parameter ',
github pailabteam / pailab / pailab / analysis / tools_jupyter.py View on Github external
def get_widget(self):
        self._tab = widgets.Tab(children=[
            self._output,
            widgets.HBox(children=[
                self._data.get_widget(),
                self._measures.get_widget(),
                widgets.VBox(children=[
                    widgets.Label(
                        value='Model Columns'),
                    self._repo_info]
                ),
                self._button_update
            ])
        ],
            title=['Table', 'Settings']
        )
        self._tab.set_title(0, 'Table')
        self._tab.set_title(1, 'Settings')
github hectornieto / pyTSEB / pyTSEB / TSEBIPythonInterface.py View on Github external
value=self.output_image_file,
            width=500)
        # Run pyTSEB button
        self.w_runmodel = widgets.Button(
            description='Run pyTSEB',
            background_color='green')
        # Create TSEB options widgets
        self.select_model()
        self.define_site_description_image()
        self.meteorology()
        self.spectral_properties_image()
        self.surface_properties_image()
        self.resistances_image()
        self.additional_options_point()
        # Model Selection tabs
        tabs = widgets.Tab(
            children=[
                self.w_model,
                self.site_page,
                self.met_page,
                self.spec_page,
                self.veg_page,
                self.res_page,
                self.opt_page])
        tabs.set_title(0, 'TSEB Model')
        tabs.set_title(1, 'Site Description')
        tabs.set_title(2, 'Meteorology')
        tabs.set_title(3, 'Spectral Properties')
        tabs.set_title(4, 'Canopy Description')
        tabs.set_title(5, 'Resistance Model')
        tabs.set_title(6, 'Additional Options')
        # Display widgets
github enthought / traitsui / traitsui / ipywidgets / ui_panel.py View on Github external
def panel(ui):
    ui.info.bind_context()

    content = ui._groups
    n_groups = len(content)

    if n_groups == 0:
        panel = None
    elif n_groups == 1:
        panel = GroupPanel(content[0], ui).control
    elif n_groups > 1:
        panel = ipywidgets.Tab()
        _fill_panel(panel, content, ui)
        panel.ui = ui

    # not handling scrollable for now

    return panel
github fastai / fastai / fastai / widgets / class_confusion.py View on Github external
self._boxes = len(self.df_list)
            self._cols = math.ceil(math.sqrt(self._boxes))
            self._rows = math.ceil(self._boxes/self._cols)
            self.tbnames = list(self.df_list[0].columns)[:-1] if self.varlist is None else self.varlist
        else:
            vals = self.interp.most_confused()
            self._ranges = []
            self.tbnames = []
            self._boxes = int(input('Please enter a value for `k`, or the top images you will see: '))
            for x in iter(vals):
                for y in range(len(self.lis)):
                    if x[0:2] == self.lis[y]:
                        self._ranges.append(x[2])
                        self.tbnames.append(str(x[0] + ' | ' + x[1]))
        items = [widgets.Output() for i, tab in enumerate(self.tbnames)]
        self.tabs = widgets.Tab()
        self.tabs.children = items
        for i in range(len(items)):
            self.tabs.set_title(i, self.tbnames[i])
        self._populate_tabs()
github MechWolf / MechWolf / mechwolf / core / experiment.py View on Github external
"Start time": time.ctime(self.created_time),
            "Expected completion": time.ctime(
                self.created_time + self.protocol._inferred_duration
            ),
            "Procedure count": sum([len(x) for x in self._compiled_protocol.values()]),
            "Abort on error": strict,
            "Log file": self._log_file.absolute() if self._log_file else None,
            "Data file": self._data_file.absolute() if self._data_file else None,
        }.items():
            if not v:
                continue
            metadata += f"<li><b>{k}:</b> {v}</li>"
        metadata += ""

        # create the output tab widget with a log tab
        self._tab = widgets.Tab()
        self._log_widget = widgets.Output()
        self._tab.children = (self._log_widget, widgets.HTML(value=metadata))
        self._tab.set_title(0, "Log")
        self._tab.set_title(1, "Metadata")

        if self._sensors:
            self._sensor_outputs = {s: widgets.Output() for s in self._sensors}

            self._accordion = widgets.Accordion(
                children=tuple(self._sensor_outputs.values())
            )
            self._tab.children = tuple(list(self._tab.children) + [self._accordion])
            self._tab.set_title(2, "Sensors")

            # we know that the accordion will line up with the dict since dict order
            # is preserved in Python 3.7+
github rheiland / PhysiCell_tools / pc4nanobio / bin / pc4nanobio.py View on Github external
sub.mcds_plot.update()

select_output_dir.observe(output_dir_cb)

# select_output_dir = widgets.Dropdown(
#     options=['foo1','foo2'],
#     value= 'foo2',
#     disabled = True,
# )

# write_config_row = widgets.HBox([write_config_button, write_config_file])
write_config_row = widgets.HBox([write_config_button, write_config_file, select_output_dir])

#----------------------
#tabs = widgets.Tab(children=[config_tab.tab, cells.tab, nanopart.tab, svg.tab, sub.tab, mydata.tab], layout=tab_layout)  
tabs = widgets.Tab(children=[config_tab.tab, cells.tab, nanopart.tab, svg.tab, sub.tab,], layout=tab_layout)  
tab_idx = 0
tabs.set_title(tab_idx, 'Config Basics'); tab_idx += 1
tabs.set_title(tab_idx, 'Cell Properties'); tab_idx += 1
tabs.set_title(tab_idx, 'Nanoparticles'); tab_idx += 1
# tabs.set_title(tab_idx, 'XML'); tab_idx += 1
tabs.set_title(tab_idx, 'Cell Plots'); tab_idx += 1
tabs.set_title(tab_idx, 'Substrate Plots'); tab_idx += 1
#tabs.set_title(tab_idx, 'Data'); 

def tab_cb(b):
    global select_output_dir
#    print(tabs.selected_index)
    if (tabs.selected_index > 2):
        select_output_dir.disabled = False
    #     write_config_row = widgets.HBox([write_config_button, write_config_file, select_output_dir])
    else: