-
Notifications
You must be signed in to change notification settings - Fork 950
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
Converting widgets to static png #2280
Comments
Another variant on this is the ability to capture and export any cell output, such as a styled Rationale: styled tables may include things like graphical items. Exporting to simple markdown that expects simple markdown style tables will lose the rich styling / image embeds. In such a case, a graphic variant of the table provides a useful alternative. Possibly related packages / techniques:
|
Related: convert widgets to pretty text. Is there any way to manually specify how to convert a widget into plain text for non-HTML display? Specifically I was thinking about inheriting/adding I'd like to know if overriding class MyWidget(SomeIPYWidget):
def __repr__(self):
return convert_to_markdown_table(self) |
Very much interested in that, I would like to be able to export the full widget with the page theme also because it is an important piece in the look I need to reproduce. |
Looks like this still doesn't have solution in 2021. You can capture screenshot using PIL, but need bounding box for that. I don't think it's too much extra work to include such information in widget itslef which could be accessed in python side. I can, technically share a value between python and JavaScript through a widget, but that doesn't work in all frontend, e.g IPython.display.Javascript works in Jupyter lab, but Voila and VScode complain that JavaScript is disabled in Jupyter lab ( fantastic joke!). |
For various reasons, people want to be able to convert a widget to a PNG
Some work has been done in jupyter/nbconvert#901 but it led to too much library specific code ending up there, for instance
The solution would be, to have an API for the DOMWidgetView, that makes a screenshot of itself (lets assume html2canvas here. Widgets that need specific behaviour, like VBox, bqplot's Figure, could implement that.
@SylvainCorlay also proposed an way to get a 'static' DOM clone of the view, for instance, for bqplot that would be the self contained svg version of itself. Maybe he could elaborate a bit more on this vision.
Previous work
#314 included a superset of this, I'd like to only add an API for this. The interface for converting to static widget/screenshot, or making screenshots as discussed in #1291 could be attacked in a different PR.
The text was updated successfully, but these errors were encountered: