AwesomeIcon#
Font-Awesome icons for markers, see https://fontawesome.com/v4.7.0/icons for available icons.
Example#
from ipyleaflet import AwesomeIcon, Marker, Map
center = (38.91342738235981, -77.03912909142674)
icon1 = AwesomeIcon(
name='bus',
marker_color='red',
icon_color='black',
spin=False
)
marker1 = Marker(icon=icon1, location=(center[0], center[1] - 0.05))
icon2 = AwesomeIcon(
name='gear',
marker_color='green',
icon_color='darkgreen',
spin=True
)
marker2 = Marker(icon=icon2, location=(center[0], center[1] + 0.05))
m = Map(center=center, zoom=13)
m.add_layer(marker1)
m.add_layer(marker2)
m
Interactions#
Unlike other widgets in ipyleaflet, the AwesomeIcon
widget is not dynamic. If you want to dynamically update the marker icon, you need to reassign the Marker.icon
property with a new icon.
marker1.icon = AwesomeIcon(
name='home',
marker_color='blue',
icon_color='black'
)
Attributes#
- class ipyleaflet.leaflet.AwesomeIcon(**kwargs)[source]#
AwesomeIcon class.
FontAwesome icon used for markers.
- name#
The name of the FontAwesome icon to use. See https://fontawesome.com/v4.7.0/icons for available icons.
- Type
string, default “home”
- marker_color#
Color used for the icon background.
- Type
string, default “blue”
- icon_color#
CSS color used for the FontAwesome icon.
- Type
string, default “white”
- spin#
Whether the icon is spinning or not.
- Type
boolean, default False