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

Widget support for Folium and pivis.Network outputs #81

Closed
absripad opened this issue Mar 25, 2023 · 1 comment
Closed

Widget support for Folium and pivis.Network outputs #81

absripad opened this issue Mar 25, 2023 · 1 comment

Comments

@absripad
Copy link

  • shinywidgets version:
  • Python version: 3.11.2
  • Operating System: Windows

Description

Looking for way to display outputs from Folium and pivis.Network on Shiny

Code attached. Works for ipyleaflet maps.

import folium
from shiny import *
from shinywidgets import output_widget, register_widget, render_widget
import ipyleaflet as L

m = folium.Map(location=[45, -122], zoom_start = 12)
m.save('map.html')

app_ui = ui.page_fluid(
ui.output_text_verbatim("txt"),
output_widget('ddd')
)

def server(input, output, session):
@output
@render.text
def txt():
return 'Map from Folium'

@output
@render_widget
def ddd():
    return m()
    # return m     # Does NOT Work
    # return m._repr_html_()     # Does NOT Work
    # return L.Map(center=(51, 0), zoom=12)    # WORKS!

app = App(app_ui, server)

@cpsievert
Copy link
Collaborator

Duplicate of #71 and #63 (please see this comment #71 (comment))

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

2 participants