From 643a567ed3390f18156dad5f266b45312128dfce Mon Sep 17 00:00:00 2001 From: pixelsapphire <35204889+pixelsapphire@users.noreply.github.com> Date: Tue, 17 Dec 2024 20:15:23 +0100 Subject: [PATCH] Add CustomIcon as accepted type of Marker icon --- folium/map.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/folium/map.py b/folium/map.py index 60d5c10aa..758e64153 100644 --- a/folium/map.py +++ b/folium/map.py @@ -5,7 +5,7 @@ import warnings from collections import OrderedDict -from typing import List, Optional, Sequence, Union +from typing import TYPE_CHECKING, List, Optional, Sequence, Union from branca.element import Element, Figure, Html, MacroElement @@ -21,6 +21,9 @@ validate_location, ) +if TYPE_CHECKING: + from folium.features import CustomIcon, DivIcon + class Evented(MacroElement): """The base class for Layer and Map @@ -373,7 +376,7 @@ def __init__( location: Optional[Sequence[float]] = None, popup: Union["Popup", str, None] = None, tooltip: Union["Tooltip", str, None] = None, - icon: Optional[Union[Icon, "DivIcon"]] = None, + icon: Optional[Union[Icon, "CustomIcon", "DivIcon"]] = None, draggable: bool = False, **kwargs: TypeJsonValue, ):