jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.48k stars 363 forks source link

'Map' object has no attribute 'on_displayed #1096

Open mdavid3 opened 1 year ago

mdavid3 commented 1 year ago

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'