How to use the ipywidgets.HTML 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 Azure / Azure-Sentinel / Notebooks / SentinelUtilities / SentinelRegi / regi_controller.py View on Github external
def process_tabular_data(self, box):
        data_table = []
        try:
            if self.regi_helper.current_key.values_number() != 0:  
                for value in self.regi_helper.get_value_list():
                    data_table.append([value.name(), value.value_type_str(), value.value()])
                # end of Value loop
        except:
            print(sys.exc_info()[1])
        
        pd.set_option('display.max_colwidth', -1)
        df = pd.DataFrame(data_table, columns=RegiViewHelper.define_value_table_columns())
        box.children = tuple([widgets.HTML(RegiViewHelper.get_summary_table_style() + df.to_html(classes="df", escape=True))])
        box.layout = RegiViewHelper.define_box_layout()
github Qiskit / qiskit-ibmq-provider / qiskit / providers / ibmq / jupyter / gates_widget.py View on Github external
backend: The backend to display.

    Returns:
        A widget with gate information.
    """
    props = backend.properties().to_dict()
    update_date = props['last_update_date']
    date_str = update_date.strftime("%a %d %B %Y at %H:%M %Z")

    multi_qubit_gates = [g for g in props['gates'] if len(g['qubits']) > 1]

    header_html = "<div><font style="font-weight:bold">{key}</font>: {value}</div>"
    header_html = header_html.format(key='last_update_date',
                                     value=date_str)

    update_date_widget = wid.HTML(value=header_html,
                                  layout=wid.Layout(grid_area='top'))

    gate_html = ""
    gate_html += """<table><style>
table {
    border-collapse: collapse;
    font-family:IBM Plex Sans, Arial, sans-serif !important;

}

th, td {
    text-align: left;
    padding: 8px !important;
}

tr:nth-child(even) {background-color: #f6f6f6;};</style></table>
github ioam / paramnb / paramnb / widgets.py View on Github external
def HTMLWidget(*args, **kw):
    """Forces a parameter value to be text, displayed as HTML"""
    kw['value'] = str(kw['value'])
    return HTML(*args,**kw)
github Jupyter-Kale / kale / kale / examples / graphene / graphene_widget.py View on Github external
[-100, 100],
                     [-100, 100]]
        
        maxprocs = 32
        maxnodes = 32
        maxsteps = 1e20
        
        slider_style = dict(
            description_width = 'initial'
        )
        slider_layout = dict(
            max_width = '250px'
        )
        
        # UI Elements
        self._title = ipw.HTML("<h1>Graphene Simulator")
        self._accordion = ipw.Accordion()
        
        self._name_label = ipw.Label("Simulation Name")
        self._name = ipw.Text()
        
        self._base_dir_label = ipw.Label("Base Directory")
        self._base_dir = ipw.Text(value=os.getcwd())
        
        self._queue_label = ipw.Label("Queue")
        self._queue = ipw.Text('cori')
        
        self._partition_label = ipw.Label("Partition")
        self._partition = ipw.Text('debug')
        
        self._job_time_label = ipw.Label("Time Allocation")
        self._job_time = ipw.Text('10:00')</h1>
github gee-community / gee_tools / geetools / ui / ipytools.py View on Github external
try:
                    info = image.getInfo()
                    width = int(info['bands'][0]['dimensions'][0])
                    height = int(info['bands'][0]['dimensions'][1])

                    new_width = int(self.thumb_height/height*width)

                    thumb = image.getThumbURL({'dimensions':[new_width,
                                                             self.thumb_height]})
                    # wid = ImageWid(value=thumb)
                    wid_i = HTML('<img src="{}">'.format(thumb))
                    wid_info = create_accordion(info)
                    wid = HBox(children=[wid_i, wid_info])
                except Exception as e:
                    message = str(e)
                    wid = HTML(message)

            asset_acc.set_widget(index, wid)
github dask / distributed / distributed / diagnostics / progressbar.py View on Github external
def __init__(
        self,
        keys,
        scheduler=None,
        interval="100ms",
        complete=False,
        loop=None,
        **kwargs
    ):
        super(ProgressWidget, self).__init__(keys, scheduler, interval, complete)

        from ipywidgets import FloatProgress, HBox, VBox, HTML

        self.elapsed_time = HTML("")
        self.bar = FloatProgress(min=0, max=1, description="")
        self.bar_text = HTML("")

        self.bar_widget = HBox([self.bar_text, self.bar])
        self.widget = VBox([self.elapsed_time, self.bar_widget])
github BBN-Q / QGL / QGL / ChannelLibraries.py View on Github external
ct+=1
                        table_code += iter_diff(cmp1, cmp2, ct, label=label)
                    continue
                if cmp1 != cmp2:
                    table_code += f"{label}{key}{cmp1}{cmp2}"
            return table_code

        table_code = ''
        for chan in set(list(dict_1.keys()) + list(dict_2.keys())):
            if chan not in dict_1 or chan not in dict_2: # don't display differences of unique channels
                continue
            this_dict1 = dict_1[chan].__dict__
            this_dict2 = dict_2[chan].__dict__
            ct = 0
            table_code += iter_diff(this_dict1, this_dict2, ct, chan)
        display(HTML(f"{table_code}<table><tbody><tr><th>Object</th><th>Parameter</th><th>{name1}</th><th>{name2}</th></tr><tr></tr></tbody></table>"))
github gee-community / gee_tools / geetools / ui / ipymap.py View on Github external
def __init__(self, error, traceback, **kwargs):
        super(ErrorAccordion, self).__init__(**kwargs)
        self.error = '{}'.format(error).replace('&lt;','{').replace('&gt;','}')

        newtraceback = ''
        for trace in traceback[1:]:
            newtraceback += '{}'.format(trace).replace('&lt;','{').replace('&gt;','}')
            newtraceback += '<br>'

        self.traceback = newtraceback

        self.errorWid = HTML(self.error)

        self.traceWid = HTML(self.traceback)

        self.children = (self.errorWid, self.traceWid)
        self.set_title(0, 'ERROR')
        self.set_title(1, 'TRACEBACK')
github hachmannlab / chemml / cheml / notebooks / main.py View on Github external
external_receivers = widgets.Dropdown(
            options = sorted(external_inputs),
            description='input token:')
        hbox2S = widgets.HBox([bidS,refreshS, external_receivers],
                             layout=widgets.Layout(height='40px', border='dotted black 1px',
                                                   align_items='center', justify_content='center'))
        addS = widgets.Button(description="Add", layout=widgets.Layout(width='60px', margin='0px 10px 0px 0px'))
        addS.style.button_color = 'lightblue'
        addS.on_click(on_addS_clicked)
        hboxS = widgets.HBox([hbox1S, toS, hbox2S, addS],
                             layout=widgets.Layout(justify_content='space-between',
                                                   align_items='center',
                                                   margin='10px 0px 20px 0px'))

        ## Receiver
        note = widgets.HTML(value='<b> Note: </b> This page automatically avoid: (1) loops, (2) type inconsistency, and (3) more than one input per token.', layout=widgets.Layout(margin='20px 0px 0px 10px'))
        headerR = widgets.HTML(value='<b> Receive &lt;&lt;&lt; </b>', layout=widgets.Layout(width='50%',margin='10px 0px 0px 10px'))
        input_tokens = [token for token in self.pages[self.current_bid].block_params['inputs']]
        listR = widgets.HTML(value='all input tokens: %s'%', '.join(sorted(input_tokens)),
                             layout=widgets.Layout(margin='0px 0px 0px 20px'))
        rm = []
        for t in input_tokens:
            for e in self.comp_graph:
                if e[2:] == (self.current_bid, t):
                    rm.append(t)
        for token in rm:
            input_tokens.remove(token)
        receiver = widgets.Dropdown(
            options=input_tokens,
            # value=input_tokens[0],
            disabled = False,
            description = 'input token:')
github Autodesk / molecular-design-toolkit / moldesign / widgets / symmetry.py View on Github external
self.description = ipy.HTML()
        self.symm_selector = ipy.Select()
        self.symm_selector.observe(self.show_symmetry, names='value')

        self.apply_button = ipy.Button(description='Symmetrize')
        self.apply_button.on_click(self.apply_selected_symmetry)

        self.reset_button = ipy.Button(description='Reset')
        self.reset_button.on_click(self.reset_coords)

        self.apply_all_button = ipy.Button(description='Apply all',
                                           layout=ipy.Layout(padding='10px'))
        self.apply_all_button.on_click(self.set_highest_symmetry)

        self.tolerance_descrip = ipy.HTML(u'<small>tolerance/\u212B</small>',)
        self.tolerance_chooser = ipy.BoundedFloatText(value=self.tolerance.value_in(u.angstrom),
                                                      min=0.0)

        self.recalculate_button = ipy.Button(description='Recalculate')
        self.recalculate_button.on_click(self.coords_changed)

        self.symm_pane = ipy.VBox([self.description,
                                   self.symm_selector,
                                   ipy.HBox([self.apply_button, self.reset_button]),
                                   self.apply_all_button,
                                   ipy.HBox([self.tolerance_chooser, self.recalculate_button]),
                                   self.tolerance_descrip],
                                  layout=ipy.Layout(width='325px'))

        self.symmetry = None
        self.coords_changed()