How to use the ipywidgets.Label 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 RedPitaya / jupyter / redpitaya / app / generator.py View on Github external
def display (self):
            layout = ipw.Layout(border='solid 2px', margin='2px 2px 2px 2px')
            # labels
            self.lbl_waveform  = ipw.Label(value="waveform shapes"               , layout = ipw.Layout(width='100%'))
            self.lbl_output    = ipw.Label(value="amplitude [V] and offset [V]"  , layout = ipw.Layout(width='100%'))
            self.lbl_frequency = ipw.Label(value="frequency [Hz] and phase [DEG]", layout = ipw.Layout(width='100%'))
            self.lbl_channel   = ipw.Label(value="generator"                     , layout = ipw.Layout(width='100%'))
            # boxes
            self.box_enable    = ipw.VBox([self.w_enable], layout = ipw.Layout(margin='2px 2px 2px 2px'))
            self.box_waveform  = ipw.VBox([self.lbl_waveform,  self.w_waveform, self.w_duty]   , layout = layout)
            self.box_output    = ipw.VBox([self.lbl_output,    self.w_amplitude, self.w_offset], layout = layout)
            self.box_frequency = ipw.VBox([self.lbl_frequency, self.w_frequency, self.w_phase] , layout = layout)
            self.box_channel = ipw.VBox([self.lbl_channel,
                                         self.box_enable,
                                         self.box_waveform,
                                         self.box_output,
                                         self.box_frequency],
                                        layout = ipw.Layout(border='solid 2px',
                                                            padding='2px 2px 2px 2px',
                                                            margin='4px 0px 4px 0px') )
github rheiland / PhysiCell_tools / pc4nanobio / bin / config.py View on Github external
#        micron_units = HTMLMath(value=r"$\mu M$")
        micron_units = Label('micron')   # use "option m" (Mac, for micro symbol)
#        micron_units = Label('microns')   # use "option m" (Mac, for micro symbol)

        constWidth = '180px'
        # tab_height = '400px'
        tab_height = '500px'
#        tab_layout = Layout(width='900px',   # border='2px solid black',
#        tab_layout = Layout(width='850px',   # border='2px solid black',
#                            height=tab_height, overflow_y='scroll',)
#        np_tab_layout = Layout(width='800px',  # border='2px solid black',
#                               height='350px', overflow_y='scroll',)

        # my_domain = [0,0,-10, 2000,2000,10, 20,20,20]  # [x,y,zmin,  x,y,zmax, x,y,zdelta]
#        label_domain = Label('Domain ($\mu M$):')
        label_domain = Label('Domain (micron):')
        stepsize = 10
        self.xmin = FloatText(step=stepsize,
            # description='$X_{min}$',
            description='Xmin',
            layout=Layout(width=constWidth),
        )
        self.ymin = FloatText(step=stepsize,
            description='Ymin',
            layout=Layout(width=constWidth),
        )
        self.zmin = FloatText(step=stepsize,
            description='Zmin',
            layout=Layout(width=constWidth),
        )
        self.xmax = FloatText(step=stepsize,
            description='Xmax',
github facultyai / ipydataclean / dataclean / widget.py View on Github external
def create_widgets(self):
        super(TypeConvertWidgetController, self).create_widgets()

        self.float_percent_bar = ipywidgets.FloatProgress(
            value=0,
            min=0,
            max=100,
            description="Floats:",
            orientation="horizontal",
        )
        self.n_float = ipywidgets.Label()
        float_bar_widget = ipywidgets.HBox(
            [self.float_percent_bar, self.n_float]
        )

        self.int_percent_bar = ipywidgets.FloatProgress(
            value=0,
            min=0,
            max=100,
            description="Ints:",
            orientation="horizontal",
        )
        self.n_int = ipywidgets.Label()
        int_bar_widget = ipywidgets.HBox([self.int_percent_bar, self.n_int])

        self.str_percent_bar = ipywidgets.FloatProgress(
            value=0,
github Calysto / conx / conx / dashboard.py View on Github external
button_prev,
            #button_train,
            self.position_text,
            button_next,
            button_end,
            self.button_play,
            refresh_button
        ], layout=Layout(width='100%', height="50px"))
        length = (len(self.dataset.train_inputs) - 1) if len(self.dataset.train_inputs) > 0 else 0
        self.control_slider = IntSlider(description="Dataset index",
                                   continuous_update=False,
                                   min=0,
                                   max=max(length, 0),
                                   value=0,
                                   layout=Layout(width='100%'))
        self.total_text = Label(value="of 0", layout=Layout(width="100px"))
        self.zoom_slider = FloatSlider(description="Zoom", continuous_update=False, min=.5, max=3,
                                  value=self.net.config["svg_height"]/780.0)

        ## Hook them up:
        button_begin.on_click(lambda button: self.dataset_move("begin"))
        button_end.on_click(lambda button: self.dataset_move("end"))
        button_next.on_click(lambda button: self.dataset_move("next"))
        button_prev.on_click(lambda button: self.dataset_move("prev"))
        self.button_play.on_click(self.toggle_play)
        self.control_slider.observe(self.update_slider_control, names='value')
        refresh_button.on_click(lambda widget: (self.output.clear_output(), self.regenerate()))
        self.zoom_slider.observe(self.update_zoom_slider, names='value')
        self.position_text.observe(self.update_position_text, names='value')
        # Put them together:
        controls = VBox([HBox([self.control_slider, self.total_text], layout=Layout(height="40px")),
                         self.control_buttons], layout=Layout(width='100%'))
github OpenMined / PyGrid / grid / client.py View on Github external
def find_tasks(self):
        self.publish(channels.list_tasks, "None")
        self.all_tasks = widgets.VBox([widgets.HBox([widgets.Label('TASK NAME'), widgets.Label('ADDRESS')])])
        self.listen_to_channel(channels.list_tasks_callback(self.id), self.found_task)

        return self.all_tasks
github rheiland / PhysiCell_tools / pc4nanobio.py View on Github external
description='$O_2$: Thresh', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), mmHg_units], layout=Layout(width=width_cell_params_units))
cell0_o2_hypoxic_response = HBox([BoundedFloatText (
    min=0, step=0.1, #max=1,  
    description='Response', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), mmHg_units], layout=Layout(width=width_cell_params_units))
cell0_o2_hypoxic_sat = HBox([BoundedFloatText (
    min=0, step=0.1, #max=1,  
    description='Saturation', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), mmHg_units], layout=Layout(width=width_cell_params_units))

#-------
label_secretion = widgets.Label('Secretion:')
cell0_secretion_o2_uptake = HBox([BoundedFloatText (
    min=0, step=0.1, #max=1,  
    description='$O_2$: Uptake rate', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), min_inv_units], layout=Layout(width=width_cell_params_units))
cell0_secretion_o2_secretion = HBox([BoundedFloatText (
    min=0, step=0.1, #max=1,  
    description='Secretion rate', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), min_inv_units], layout=Layout(width=width_cell_params_units))
cell0_secretion_o2_sat = HBox([BoundedFloatText (
    min=0, step=0.1, #max=1,  
    description='Saturation', # style={'description_width': 'initial'},
    layout = Layout(width = constWidth),
    ), mmHg_units], layout=Layout(width=width_cell_params_units))
github UCLA-Plasma-Simulation-Group / pyVisOS / osh5visipy.py View on Github external
def __init__(self, filefilter, processing=do_nothing, savemovie=None, **extra_kwargs):
        if isinstance(filefilter, (tuple, list)):  # filefilter is a list of filenames
            self.datadir, self.flist, self.processing = os.path.abspath(os.path.dirname(filefilter[0])), filefilter, processing
        else:  # filefilter is a path name or a string that can be passed down to glob to get a list of file names
            fp = filefilter + '/*.h5' if os.path.isdir(filefilter) else filefilter
            self.datadir, self.flist, self.processing = os.path.abspath(os.path.dirname(fp)), sorted(glob.glob(fp)), processing
        try:
            self.data = processing(osh5io.read_h5(self.flist[0]))
        except IndexError:
            raise IOError('No file found matching ' + fp)

        self.file_slider = widgets.IntSlider(min=0, max=len(self.flist) - 1, description=os.path.basename(self.flist[0]),
                                             value=0, continuous_update=False, layout=_items_layout)
        self.time_label = widgets.Label(value=osh5vis.time_format(self.data.run_attrs['TIME'][0], self.data.run_attrs['TIME UNITS']),
                                        layout=_items_layout)

        super(DirSlicer, self).__init__(self.data, time_in_title=False, **extra_kwargs)
        if savemovie is None:
            self.savemovie = SaveMovieManager(self.fig, self.plot_ith_slice, (0, len(self.flist)))
        else:
            self.savemovie = savemovie
            self.savemovie.update_frame_range((0, len(self.flist)))
        tmp = [None] * len(self.tab_contents)
        tmp[4] = self.__get_tab_save()
        self.refresh_tab_wgt(tmp)
        self.file_slider.observe(self.update_slice, 'value')
github fitoprincipe / ipygee / ipygee / preview.py View on Github external
region = tools.geometry.getRegion(image)
        else:
            region = tools.geometry.getRegion(region)
        params = dict(dimensions=formatdimension, region=region)
        if visualization:
            params.update(visualization)
        url = image.getThumbURL(params)
        req = requests.get(url)
        content = req.content
        rtype = req.headers['Content-type']
        if rtype in ['image/jpeg', 'image/png']:
            img64 = base64.b64encode(content).decode('utf-8')
            src = '<img src="data:image/png;base64,{}">'.format(img64)
            result = HTML(src)
        else:
            result = Label(content.decode('utf-8'))

        return result
github hyperspy / hyperspy / hyperspy / gui_ipywidgets / tools.py View on Github external
# Connect
    link((obj, "ss_left_value"), (left, "value"))
    link((obj, "ss_right_value"), (right, "value"))
    link((axis, "units"), (units, "value"))

    def on_apply_clicked(b):
        obj = obj
        if obj.ss_left_value != obj.ss_right_value:
            obj.span_selector_switch(False)
            for method, cls in obj.on_close:
                method(cls, obj.ss_left_value, obj.ss_right_value)
            obj.span_selector_switch(True)
    apply.on_click(on_apply_clicked)

    box = ipywidgets.VBox([
        ipywidgets.HBox([left, units, ipywidgets.Label("-"), right, units]),
        help,
        ipywidgets.HBox((apply, close))
    ])

    def on_close_clicked(b):
        obj.span_selector_switch(False)
        box.close()
    close.on_click(on_close_clicked)
    return {
        "widget": box,
        "wdict": wdict,
    }
github exa-analytics / exatomic / exatomic / widgets / widget.py View on Github external
scn.tyz = self._df.loc[0,'yz']
            scn.tzx = self._df.loc[0,'zx']
            scn.tzy = self._df.loc[0,'zy']
            scn.tzz = self._df.loc[0,'zz']
        xs = [FloatText(value=scn.txx , layout=alo),
              FloatText(value=scn.txy , layout=alo),
              FloatText(value=scn.txz , layout=alo)]
        ys = [FloatText(value=scn.tyx , layout=alo),
              FloatText(value=scn.tyy , layout=alo),
              FloatText(value=scn.tyz , layout=alo)]
        zs = [FloatText(value=scn.tzx , layout=alo),
              FloatText(value=scn.tzy , layout=alo),
              FloatText(value=scn.tzz , layout=alo)]
        opt = [0] if self._df is None else [int(x) for x in self._df.index.values]
        tensorIndex = Dropdown(options=opt, value=opt[0], layout=rlo)
        tdxlabel = Label(value='Select the tensor index:')
        def _x0(c):
            for scn in self.active(): scn.txx = c.new
        def _x1(c):
            for scn in self.active(): scn.txy = c.new
        def _x2(c):
            for scn in self.active(): scn.txz = c.new
        def _y0(c):
            for scn in self.active(): scn.tyx = c.new
        def _y1(c):
            for scn in self.active(): scn.tyy = c.new
        def _y2(c):
            for scn in self.active(): scn.tyz = c.new
        def _z0(c):
            for scn in self.active(): scn.tzx = c.new
        def _z1(c):
            for scn in self.active(): scn.tzy = c.new