Widget Control#

Example#

from ipyleaflet import Map, basemaps, WidgetControl
from ipywidgets import IntSlider, ColorPicker, jslink

m = Map(center=(46.01, 6.16), zoom=12, basemap=basemaps.Stamen.Terrain)
zoom_slider = IntSlider(description='Zoom level:', min=0, max=15, value=7)
jslink((zoom_slider, 'value'), (m, 'zoom'))
widget_control1 = WidgetControl(widget=zoom_slider, position='topright')
m.add_control(widget_control1)

color_picker = ColorPicker(description='Pick a color:')
widget_control2 = WidgetControl(widget=color_picker, position='bottomright')
m.add_control(widget_control2)
m

Attributes#

class ipyleaflet.leaflet.WidgetControl(**kwargs)[source]#

WidgetControl class, with Control as parent class.

A control that contains any DOMWidget instance.

widget#

The widget to put inside of the control. It can be any widget, even coming from a third-party library like bqplot.

Type

DOMWidget