How to use the ipywidgets.Output 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 asvcode / Vision_UI / vision_ui.py View on Github external
disabled=False,
                                        )

    if button_g.folder.value == True and button_g.suffix.value == True:
        ui = widgets.HBox([csv_choices.drop, button_s, button_f])
    elif button_g.folder.value == False and button_g.suffix.value == False:
        ui = widgets.HBox([button_f])
    elif button_g.folder.value == True and button_g.suffix.value == False:
        ui = widgets.HBox([button_s, button_f])
    elif button_g.folder.value == False and button_g.suffix.value == True:
        ui = widgets.HBox([csv_choices.drop, button_f])

    display(ui)
    display(button_c)

    out = widgets.Output()
    display(out)

    def on_button_s(b):
        csv_folder_choice()
    button_s.on_click(on_button_s)

    def on_button_f(b):
        df_choice()
    button_f.on_click(on_button_f)

    def on_button_c(b):

        if button_g.folder.value == True and button_g.suffix.value == True:
            print(csv_folder_choice.path)
            csv_choices.folder_csv = (csv_folder_choice.path.rsplit('/', 1)[1])
            print(f'folder: {csv_choices.folder_csv}\n')
github asvcode / Vision_UI / vision_ui2.py View on Github external
def aug_choice():
    """Helper for whether augmentations are choosen or not"""
    view_button = widgets.Button(description='View')
    display(view_button)
    view_out = widgets.Output()
    display(view_out)
    def on_view_button(b):
        with view_out:
            clear_output()
            if aug_dash.aug.value == 'No':
                code_test()
            if aug_dash.aug.value == 'Yes':
                aug_paras()
    view_button.on_click(on_view_button)
github asvcode / Vision_UI / colab_ui.py View on Github external
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)

    def on_button_clicked(b):
        with out:
            clear_output()
            lr_work()
            print('>> Training....''\n''Learning Rate: ', lr_work.info)
            dashboard_one.datain.value, dashboard_one.norma.value, dashboard_one.archi.value, dashboard_one.pretrain_check.value,
            dashboard_one.f.value, dashboard_one.m.value, dashboard_two.doflip.value, dashboard_two.dovert.value,
            dashboard_two.two.value, dashboard_two.three.value, dashboard_two.seven.value, dashboard_two.four.value, dashboard_two.five.value,
            dashboard_two.six.value, dashboard_one.norma.value,metrics_list(mets_list)

            metrics_list(mets_list)

            batch_val = int(dashboard_one.f.value) # batch size
            image_val = int(dashboard_one.m.value) # image size
github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / utils / widgets.py View on Github external
def interactive_output(f, controls, process_controls=lambda x: x):
    """Connect widget controls to a function.

    This function does not generate a user interface for the widgets (unlike `interact`).
    This enables customisation of the widget user interface layout.
    The user interface layout must be defined and displayed manually.
    """

    out = Output()

    def observer(change):
        show_inline_matplotlib_plots()
        with out:
            clear_output(wait=True)
            f(**unpack_controls(controls, process_controls))
            show_inline_matplotlib_plots()
    for k, w in controls.items():
        w.observe(observer, 'value')
    show_inline_matplotlib_plots()
    observer(None)
    return out
github asvcode / Vision_UI / colab_ui.py View on Github external
def version():
    import fastai
    import os
    import tensorflow as tf
    import torch

    print ('>> Vision_UI_Colab Last Update: 07/04/2020 \n\n>> System info \n')

    button = widgets.Button(description='System Info')
    display(button)

    out = widgets.Output()
    display(out)

    def on_button_clicked_info(b):
        with out:
            clear_output()
            RED = '\033[31m'
            BLUE = '\033[94m'
            GREEN = '\033[92m'
            BOLD   = '\033[1m'
            ITALIC = '\033[3m'
            RESET  = '\033[0m'

            import fastai; print(BOLD + BLUE + "fastai Version: " + RESET + ITALIC + str(fastai.__version__))
            import fastprogress; print(BOLD + BLUE + "fastprogress Version: " + RESET + ITALIC + str(fastprogress.__version__))
            import sys; print(BOLD + BLUE + "python Version: " + RESET + ITALIC + str(sys.version))
            import torchvision; print(BOLD + BLUE + "torchvision: " + RESET + ITALIC + str(torchvision.__version__))
github xoolive / traffic / traffic / drawing / ipywidgets.py View on Github external
ipython = get_ipython()
        ipython.magic("matplotlib ipympl")
        from ipympl.backend_nbagg import FigureCanvasNbAgg, FigureManagerNbAgg

        self.fig_map = Figure(figsize=(6, 6))
        self.fig_time = Figure(figsize=(6, 4))

        self.canvas_map = FigureCanvasNbAgg(self.fig_map)
        self.canvas_time = FigureCanvasNbAgg(self.fig_time)

        self.manager_map = FigureManagerNbAgg(self.canvas_map, 0)
        self.manager_time = FigureManagerNbAgg(self.canvas_time, 0)

        layout = {"width": "590px", "height": "800px", "border": "none"}
        self.output = Output(layout=layout)

        self._traffic = traffic
        self.t_view = traffic.sort_values("timestamp")
        self.trajectories: Dict[str, List[Artist]] = defaultdict(list)

        self.create_map(projection)

        self.projection = Dropdown(options=["EuroPP", "Lambert93", "Mercator"])
        self.projection.observe(self.on_projection_change)

        self.identifier_input = Text(description="Callsign/ID")
        self.identifier_input.observe(self.on_id_input)

        self.identifier_select = SelectMultiple(
            options=sorted(self._traffic.callsigns),  # type: ignore
            value=[],
github pailabteam / pailab / pailab / analysis / tools_jupyter.py View on Github external
def __init__(self, beakerX=False):
        self._data = _DataSelector()
        self._measures = _MeasureSelector()
        self._repo_info = widgets.SelectMultiple(
            options=[k.value for k in RepoInfoKey], value=['category', 'name', 'commit_date', 'version'], layout=widgets.Layout(width='200px', height='250px')
        )
        self._output = widgets.Output(layout=widgets.Layout(
            width='1000px', height='450px', overflow_y='auto', overflow_x='auto'))
        self._button_update = widgets.Button(description='update')
        self._button_update.on_click(self.get_measures)
github nickc92 / ViewSCAD / viewscad / renderer.py View on Github external
arrow_cyl_mesh = pjs.Mesh(geometry=pjs.SphereGeometry(radius=0.01), material=pjs.MeshLambertMaterial())
        arrow_head_mesh = pjs.Mesh(geometry=pjs.SphereGeometry(radius=0.001), material=pjs.MeshLambertMaterial())
        
        scene_things = [my_object_mesh, my_object_wireframe_mesh, select_point_mesh, arrow_cyl_mesh, arrow_head_mesh,
                        camera, pjs.AmbientLight(color='#888888')]
        
        if self.draw_grids:
            grids, space = self._get_grids(vertices)
            scene_things.append(grids)

        scene = pjs.Scene(children=scene_things, background=BACKGROUND_COLOR)
        
        
        click_picker = pjs.Picker(controlling=my_object_mesh, event='dblclick')
        out = Output()
        top_msg = HTML()
        
        
        def on_dblclick(change):    
            if change['name'] == 'point':                
                try:
                    point = np.array(change['new'])
                    face = click_picker.faceIndex
                    face_points = rendered_obj.face_verts[face]                    
                    face_vecs = face_points - np.roll(face_points, 1, axis=0)
                    edge_lens = np.sqrt((face_vecs**2).sum(axis=1))
                    point_vecs = face_points - point[np.newaxis, :]
                    point_dists = (point_vecs**2).sum(axis=1)                    
                    min_point = np.argmin(point_dists)                    
                    v1s = point_vecs.copy()
                    v2s = np.roll(v1s, -1, axis=0)
github asvcode / Vision_UI / paperspace_ui.py View on Github external
def model_button():
    button_m = widgets.Button(description='Model')

    print('>> View Model information (model_summary, model[0], model[1])''\n\n''>> For xresnet: Pretrained needs to be set to FALSE')
    display(button_m)

    out_two = widgets.Output()
    display(out_two)

    def on_button_clicked_train(b):
      with out_two:
        clear_output()
        print('Your pretrained setting: ', dashboard_one.pretrain_check.value)
        model_summary()

    button_m.on_click(on_button_clicked_train)
github Qiskit / qiskit-terra / qiskit / tools / jupyter / backend_monitor.py View on Github external
def detailed_map(backend):
    """Widget for displaying detailed noise map.

    Args:
        backend (IBMQBackend | FakeBackend): The backend.

    Returns:
        GridBox: Widget holding noise map images.
    """
    error_widget = widgets.Output(layout=widgets.Layout(display='flex-inline',
                                                        align_items='center'))
    with error_widget:
        display(plot_error_map(backend, figsize=(11, 9), show_title=False))
    return error_widget