Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Popups with ipyleaflet #75

Open
RolandASc opened this issue Feb 14, 2023 · 2 comments
Open

Question: Popups with ipyleaflet #75

RolandASc opened this issue Feb 14, 2023 · 2 comments

Comments

@RolandASc
Copy link

  • shinywidgets version: 0.1.4
  • Python version: 3.10
  • Operating System: Windows

Description

We are trying to develop a Shiny Python app to visualize risks on a leaflet map.
A lot of things are working well, but some things we cannot seem to get to work.

What I Did

I went back to the example ipyleaflet app from the README here and tried to include a popup. The popup shows, but I couldn't figure out how I am supposed to set the child element to get any content into the popup. I tried using HTML() from ipywidgets, I tried registering that with register_widget() and a few other things, but the result was always that either the map would not load anymore, or I would get an error like
_send_error_response: The 'child' trait of a Popup instance expected a DOMWidget or None

from shiny import *
from shinywidgets import output_widget, register_widget, reactive_read
import ipyleaflet as L
import ipywidgets as W

<...>

    map = L.Map(center=(52, 0), zoom=4)
    pop_child = W.HTML(value="hi")
    register_widget("popchild", pop_child)
    popup = L.Popup(location=(52, 0), child=pop_child)
    map.add(popup)
    register_widget("map", map)

Do you know of any way that I might get this to work?

@filipwastberg
Copy link

What version of ipywidgets do you have?

@vatula
Copy link

vatula commented Nov 7, 2024

@filipwastberg The issue happens with ipywidgets 8+. It affects current python shiny + shinylive + leaflet combination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants