We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
as_widget()
1 parent 178da20 commit 5a6f7f0Copy full SHA for 5a6f7f0
shinywidgets/_as_widget.py
@@ -17,7 +17,11 @@ def as_widget(x: object) -> Widget:
17
18
_as_widget = AS_WIDGET_MAP.get(pkg, None)
19
if _as_widget is None:
20
- raise TypeError(f"Don't know how to coerce {x} into a ipywidget.Widget object.")
+ msg = f"Don't know how to coerce {x} into a ipywidget.Widget object."
21
+ if callable(getattr(x, "_repr_html_", None)):
22
+ msg += " Instead of using shinywidgets to render this object, try using shiny's @render.ui decorator "
23
+ msg += " https://shiny.posit.co/py/api/ui.output_ui.html#shiny.ui.output_ui"
24
+ raise TypeError(msg)
25
26
res = _as_widget(x)
27
0 commit comments