本文整理汇总了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)
示例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
示例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
示例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
示例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)
示例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
示例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
示例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 = ' '.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__))
示例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()
示例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])
示例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'),)
示例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])
示例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
示例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)
示例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