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

Embedding the viewer snippet in a html is changing behaviour of widget #754

Open
romcenci opened this issue May 23, 2024 · 0 comments
Open

Comments

@romcenci
Copy link

romcenci commented May 23, 2024

Hi, I'm trying to embed the created viewer snippet in an HTML, but when we try to do this the axes don't preserve its state, which needs to be False in our case. I'm attaching a reproducible example of what we're doing and some images of the behavior. Do you know if it's possible to preserve this property after exporting it to HTML?
I'm using version 0.32.6.

import vtk
from itkwidgets import view
from ipywidgets import embed

sphere = vtk.vtkSphereSource()
sphere.SetRadius(1)
sphere.Update()

viewer = view(
    geometries=sphere.GetOutput(),
    ui_collapsed=True,
    axes=False,
    background=(255,255,255),
)

snippet = embed.embed_snippet(viewer)
html = embed.html_template.format(title="", snippet=snippet)

with open("index.html","w") as f:
    f.write(html)

In Jupyter notebook the widget works fine:

image

But in html exported we are having this:

image

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

1 participant