当前位置: 首页>>代码示例>>Python>>正文


Python ipywidgets.HTML属性代码示例

本文整理汇总了Python中ipywidgets.HTML属性的典型用法代码示例。如果您正苦于以下问题:Python ipywidgets.HTML属性的具体用法?Python ipywidgets.HTML怎么用?Python ipywidgets.HTML使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在ipywidgets的用法示例。


在下文中一共展示了ipywidgets.HTML属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: renderWidget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def renderWidget(chart, width=None, height=None):
    """ Render a pygal chart into a Jupyter Notebook """
    from ipywidgets import HTML

    b64 = base64.b64encode(chart.render()).decode('utf-8')

    src = 'data:image/svg+xml;charset=utf-8;base64,'+b64

    if width and not height:
        html = '<embed src={} width={}></embed>'.format(src, width)
    elif height and not width:
        html = '<embed src={} height={}></embed>'.format(src, height)
    elif width and height:
        html = '<embed src={} height={} width={}></embed>'.format(src,
                                                                  height,
                                                                  width)
    else:
        html = '<embed src={}>'.format(src)

    return HTML(html) 
开发者ID:fitoprincipe,项目名称:ipygee,代码行数:22,代码来源:chart.py

示例2: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def make_labels():
    """Makes the labels widget.

    Returns:
        widget: The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='145px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='95px'))
    labels3 = widgets.HTML(value='<h5>Queue</h5>',
                           layout=widgets.Layout(width='70px'))
    labels4 = widgets.HTML(value='<h5>Message</h5>')

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3, labels4],
                          layout=widgets.Layout(width='600px',
                                                margin='0px 0px 0px 37px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-terra,代码行数:22,代码来源:job_widgets.py

示例3: point_leaflet

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def point_leaflet(point: "PointMixin", **kwargs) -> Marker:
    """Returns a Leaflet layer to be directly added to a Map.

    .. warning::
        This is only available if the Leaflet `plugin <plugins.html>`_ is
        activated. (true by default)

    The elements passed as kwargs as passed as is to the Marker constructor.
    """

    default = dict()
    if hasattr(point, "name"):
        default["title"] = point.name

    kwargs = {**default, **kwargs}
    marker = Marker(location=(point.latitude, point.longitude), **kwargs)

    label = HTML()
    label.value = repr(point)
    marker.popup = label

    return marker 
开发者ID:xoolive,项目名称:traffic,代码行数:24,代码来源:leaflet.py

示例4: make_labels

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def make_labels() -> widgets.HBox:
    """Makes the labels widget.

    Returns:
        The labels widget.
    """
    labels0 = widgets.HTML(value="<h5>Job ID</h5>",
                           layout=widgets.Layout(width='190px'))
    labels1 = widgets.HTML(value='<h5>Backend</h5>',
                           layout=widgets.Layout(width='165px'))
    labels2 = widgets.HTML(value='<h5>Status</h5>',
                           layout=widgets.Layout(width='125px'))
    labels3 = widgets.HTML(value='<h5>Est. Start Time</h5>',
                           layout=widgets.Layout(width='100px'))

    labels = widgets.HBox(children=[labels0, labels1, labels2, labels3],
                          layout=widgets.Layout(width='700px',
                                                margin='0px 0px 0px 35px'))
    return labels 
开发者ID:Qiskit,项目名称:qiskit-ibmq-provider,代码行数:21,代码来源:job_widgets.py

示例5: _title_builder

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def _title_builder(sel_dict: dict) -> str:
    """Build the title string for the jobs table.

    Args:
        sel_dict: Dictionary containing information on jobs.

    Returns:
        HTML string for title.
    """
    if 'day' not in sel_dict.keys():
        title_str = 'Jobs in {mon} {yr} ({num})'.format(mon=MONTH_NAMES[sel_dict['month']],
                                                        yr=sel_dict['year'],
                                                        num=len(sel_dict['jobs']))
    else:
        title_str = 'Jobs on {day} {mon} {yr} ({num})'.format(day=sel_dict['day'],
                                                              mon=MONTH_NAMES[sel_dict['month']],
                                                              yr=sel_dict['year'],
                                                              num=len(sel_dict['jobs']))
    return "<h4>{}</h4>".format(title_str) 
开发者ID:Qiskit,项目名称:qiskit-ibmq-provider,代码行数:21,代码来源:jobs_widget.py

示例6: _widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def _widget(self):
        if not hasattr(self, "_cached_widget"):
            try:
                import ipywidgets

                children = [ipywidgets.HTML("<h2>Cluster Options</h2>")]
                children.extend([f.widget() for f in self._fields.values()])
                column = ipywidgets.Box(
                    children=children,
                    layout=ipywidgets.Layout(
                        display="flex", flex_flow="column", align_items="stretch"
                    ),
                )
                widget = ipywidgets.Box(children=[column])
            except ImportError:
                widget = None
            object.__setattr__(self, "_cached_widget", widget)
        return self._cached_widget 
开发者ID:dask,项目名称:dask-gateway,代码行数:20,代码来源:options.py

示例7: widget

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def widget(self):
        import ipywidgets

        def handler(change):
            self.set(change.new)

        input = self._widget()
        input.observe(handler, "value")
        self._widgets.add(input)

        label = ipywidgets.HTML(
            "<p style='font-weight: bold; margin-right: 8px'>%s:</p>" % self.label
        )

        row = ipywidgets.Box(
            children=[label, input],
            layout=ipywidgets.Layout(
                display="flex", flex_flow="row wrap", justify_content="space-between"
            ),
        )

        return row 
开发者ID:dask,项目名称:dask-gateway,代码行数:24,代码来源:options.py

示例8: make_header

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def make_header(self):
        img = io.open(os.path.join(mdt.PACKAGEPATH, '_static_data/img/banner.png'), 'r+b').read()
        encoded = base64.b64encode(img).decode('ascii')
        img = '<img style="max-width:100%" src=data:image/png;base64,'+('%s>'%encoded)
        links = [self._makelink(*args) for args in
                   (("http://moldesign.bionano.autodesk.com/", 'About'),
                    ("https://github.com/autodesk/molecular-design-toolkit/issues", 'Issues'),
                    ("http://bionano.autodesk.com/MolecularDesignToolkit/explore.html",
                     "Tutorials"),
                    ('http://autodesk.github.io/molecular-design-toolkit/', 'Documentation'),
                    ('https://lifesciences.autodesk.com/', 'Adsk LifeSci')
                    )]
        linkbar = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.join(links)
        return ipy.HTML(("<span style='float:left;font-size:0.8em;font-weight:bold'>Version: "
                         "{version}</span>"
                         "<span style='float:right'>{linkbar}</span>"
                         "<p>{img}</p>").format(img=img, linkbar=linkbar, version=mdt.__version__)) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:19,代码来源:compute.py

示例9: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def __init__(self, pyname, getversion=False):
        self.displays = {}
        self.pyname = pyname
        self.getversion = getversion

        self.nbv_display = VBox()
        self.widgets_display = VBox()
        self.warning = ipywidgets.HTML()

        super().__init__()
        children = [ipywidgets.HTML("<h4><center>%s</center></h4>" % self.pyname,
                                    layout=ipywidgets.Layout(align_self='center')),
                    ipywidgets.HTML(self.HEADER)]

        for location in install.nbextension_ordered_paths():
            self.state = install.get_installed_versions(self.pyname, self.getversion)
            props = self._get_props(location)
            self.displays[location] = ExtensionInstallLocation(self, props)
            children.append(self.displays[location])

        children.append(self.warning)

        self.children = children
        self._highlight_active() 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:26,代码来源:visualization.py

示例10: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def __init__(self, image, client):
        self._err = False
        self._client = client
        self.image = image
        self.status = ipy.HTML(layout=ipy.Layout(width="20px"))
        self.html = ipy.HTML(value=image, layout=ipy.Layout(width="400px"))
        self.html.add_class('nbv-monospace')
        self.msg = ipy.HTML(layout=ipy.Layout(width='300px'))
        self.button = ipy.Button(layout=ipy.Layout(width='100px'))
        if mdt.compute.config.devmode:
            self.button.on_click(self.rebuild)
        else:
            self.button.on_click(self.pull)
        self._reactivate_button()
        self._set_status_value()
        super().__init__(children=[self.status, self.html, self.button, self.msg]) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:18,代码来源:images.py

示例11: _set_tool_state

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def _set_tool_state(self, *args):
        """ Observes the `viewer.selected_atom_indices` list and updates the tool panel accordingly

        Returns:
            Tuple(ipywidgets.BaseWidget): children of the tool panel
        """
        atoms = self.viewer.selected_atoms
        with self.viewer.hold_trait_notifications():
            for shape in self._widgetshapes.values():
                if shape == '_axes':
                    self.viewer.draw_axes(False)
                else:
                    self.viewer.remove(shape)
            self._widgetshapes = {}

        if len(atoms) == 1:
            self._setup_atom_tools(atoms)
        elif len(atoms) == 2:
            self._setup_distance_tools(atoms)
        elif len(atoms) == 3:
            self._setup_angle_tools(atoms)
        elif len(atoms) == 4:
            self._setup_dihedral_tools(atoms)
        else:
            self.tool_holder.children = (ipy.HTML('Please click on 1-4 atoms'),) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:27,代码来源:geombuilder.py

示例12: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def __init__(self, format=None, *args, **kwargs):
        description = kwargs.pop('description', 'FloatSlider')
        min = kwargs.setdefault('min', 0.0)
        max = kwargs.setdefault('max', 10.0)
        self.formatstring = format
        self.header = ipy.HTML()
        self.readout = ipy.Text(layout=ipy.Layout(width='100px'))
        self.readout.on_submit(self.parse_value)

        kwargs.setdefault('readout', False)
        self.slider = ipy.FloatSlider(*args, **process_widget_kwargs(kwargs))
        self.minlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(min)))
        self.maxlabel = ipy.HTML(u'<font size=1.5>{}</font>'.format(self.formatstring.format(max)))
        self.sliderbox = HBox([self.minlabel, self.slider, self.maxlabel])
        traitlets.link((self, 'description'), (self.header, 'value'))
        traitlets.link((self, 'value'), (self.slider, 'value'))
        self.description = description
        self.update_readout()
        super().__init__([self.header,
                                                  self.readout,
                                                  self.sliderbox]) 
开发者ID:Autodesk,项目名称:notebook-molecular-visualization,代码行数:23,代码来源:components.py

示例13: animate

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def animate(self, iteration):

        # We only update the progress bar if the progress has gone backward,
        # or if the progress has increased by at least 1%. This is to avoid
        # updating it too much, which would fill log files in text mode,
        # or slow down the computation in HTML mode

        this_percent = iteration / float(self._iterations) * 100.0

        if this_percent - self._last_printed_percent < 0 or (this_percent - self._last_printed_percent) >= 1:

            self._last_iteration = self._animate(iteration)

            self._last_printed_percent = this_percent

        else:

            self._last_iteration = iteration 
开发者ID:threeML,项目名称:threeML,代码行数:20,代码来源:progress_bar.py

示例14: __init__

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def __init__(self):
        self._sc = Sidecar(title='Variables')
        get_ipython().user_ns_hidden['widgets'] = widgets
        get_ipython().user_ns_hidden['NamespaceMagics'] = NamespaceMagics

        self.closed = False
        self.namespace = NamespaceMagics()
        self.namespace.shell = get_ipython().kernel.shell

        self._box = widgets.Box()
        self._box.layout.overflow_y = 'scroll'
        self._table = widgets.HTML(value='Not hooked')
        self._box.children = [self._table]

        self._ipython = get_ipython()
        self._ipython.events.register('post_run_cell', self._fill) 
开发者ID:timkpaine,项目名称:lantern,代码行数:18,代码来源:variable_inspector.py

示例15: addFeature

# 需要导入模块: import ipywidgets [as 别名]
# 或者: from ipywidgets import HTML [as 别名]
def addFeature(self, feature, visParams=None, name=None, show=True,
                   opacity=None, replace=True,
                   inspect={'data':None, 'reducer':None, 'scale':None}):
        """ Add a Feature to the Map

        :param feature: the Feature to add to Map
        :type feature: ee.Feature
        :param visParams:
        :type visParams: dict
        :param name: name for the layer
        :type name: str
        :param inspect: when adding a geometry or a feature you can pop up data
            from a desired layer. Params are:
            :data: the EEObject where to get the data from
            :reducer: the reducer to use
            :scale: the scale to reduce
        :type inspect: dict
        :return: the name of the added layer
        :rtype: str
        """
        thename = name if name else 'Feature {}'.format(self.addedGeometries)

        # Check if layer exists
        if thename in self.EELayers.keys():
            if not replace:
                print("Layer with name '{}' exists already, please choose another name".format(thename))
                return
            else:
                self.removeLayer(thename)

        params = getGeojsonTile(feature, thename, inspect)
        layer = ipyleaflet.GeoJSON(data=params['geojson'],
                                   name=thename,
                                   popup=HTML(params['pop']))

        self._add_EELayer(thename, {'type': 'Feature',
                                    'object': feature,
                                    'visParams': None,
                                    'layer': layer})
        return thename 
开发者ID:fitoprincipe,项目名称:ipygee,代码行数:42,代码来源:map.py


注:本文中的ipywidgets.HTML属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。