Skip to content

'Map' object has no attribute 'on_displayed #1096

@mdavid3

Description

@mdavid3

I get an error when I run the code below in jupiter lab. How can I fix ?

Set study area using ipyleaflet
m = Map(center=(14, -90), zoom = 6)
draw_control = DrawControl(polyline={}, circlemarker={}, polygon={})
draw_control.rectangle = {
    "shapeOptions": {
        "fillColor": "#fca45d",
        "color": "#fca45d",
        "fillOpacity": 0.2

    }
}
m.add_control(draw_control)
m

AttributeError Traceback (most recent call last)
Cell In[30], line 2
1 # Set study area using ipyleaflet
----> 2 m = Map(center=(14, -90), zoom = 6)
3 draw_control = DrawControl(polyline={}, circlemarker={}, polygon={})
4 draw_control.rectangle = {
5 "shapeOptions": {
6 "fillColor": "#fca45d",
(...)
9 }
10 }

File ~/.local/lib/python3.10/site-packages/ipyleaflet/leaflet.py:457, in Map.init(self, **kwargs)
455 def init(self, **kwargs):
456 super(Map, self).init(**kwargs)
--> 457 self.on_displayed(self._fire_children_displayed)
458 if self.default_tiles is not None:
459 self.layers = (self.default_tiles,)

AttributeError: 'Map' object has no attribute 'on_displayed'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @martinRenou@mdavid3

        Issue actions

          'Map' object has no attribute 'on_displayed · Issue #1096 · jupyter-widgets/ipyleaflet