-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
posit-dev/py-htmltools
#47Description
- shinywidgets version: 0.1.4
- Python version: 3.10.6
- Operating System: Windows 10
Description
I am trying to replicate the code examples provided and am able to register widgets without issue.
https://github.com/rstudio/py-shinywidgets/blob/main/examples/ipyleaflet/app.py
However, I do not get an output from this code, even if I modify the code to replicate just the leaflet example.
https://github.com/rstudio/py-shinywidgets/blob/main/examples/outputs/app.py
I believe this may be related to the following message I receive when running the code this way:
"GET /lib/ipywidget-libembed-amd-1.0.1%5Clibembed-amd.js HTTP/1.1" 404 Not Found
What I Did
import warnings
import pandas as pd
import numpy as np
from shiny import *
from shinywidgets import *
from htmltools import head_content, HTML
app_ui = ui.page_fluid(
ui.layout_sidebar(
ui.panel_sidebar(
ui.input_radio_buttons(
"framework",
"Choose an ipywidget package",
[
"ipyleaflet",
],
selected="ipyleaflet",
)
),
ui.panel_main(
ui.output_ui("figure"),
),
),
title="ipywidgets in Shiny",
)
def server(input: Inputs, output: Outputs, session: Session):
@output(id="figure")
@render.ui
def _():
return output_widget(input.framework())
@output(id="ipyleaflet")
@render_widget
def _():
from ipyleaflet import Map, Marker
m = Map(center=(52.204793, 360.121558), zoom=4)
m.add_layer(Marker(location=(52.204793, 360.121558)))
return m
app = App(app_ui, server)
Metadata
Metadata
Assignees
Labels
No labels