Search code examples
pythonleafletfolium

'tooltip' is not working in python leaflet mapping


I am using python 3.6 Following is my simple code:

import folium
city_location = [-23.6573395, -46.5322504]

m = folium.Map(location=city_location, zoom_start=15, tiles='openstreetmap')

folium.Marker(city_location, popup='<i>Teste</i>', tooltip='Click me!').add_to(m)
m

But I keep getting the error saying:

TypeError: __init__() got an unexpected keyword argument 'tooltip'

What can I do to show a tooltip upon my marker ?


Solution

  • The tooltip was added with the version v.0.0.6. Refer to this issue : https://github.com/python-visualization/folium/pull/724

    From your comment, it was six month after you installed it. So, update your dependencies and it should work

    You can check your version by doing pip freeze > requirements.txt

    Check the folium version there. If it is under 0.0.6, then perform a : pip install folium --upgrade and you are done

    Also, check the Release page, this library is in active development, so you should always update if you want to enjoy and test the last features !