InsightSoftwareConsortium / InsightSoftwareConsortium/itkwidgets

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

Aperta
#754 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
624
Fork
83
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

```python
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](https://github.com/InsightSoftwareConsortium/itkwidgets/assets/28690931/14a8992e-b7b6-4b46-94da-6d6f146c1e23)

But in html exported we are having this:

![image](https://github.com/InsightSoftwareConsortium/itkwidgets/assets/28690931/6ca9be73-7650-4924-8d47-23c657eed853)

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia con la riproduzione Python fornita usando itkwidgets.view e ipywidgets.embed_snippet/html_template, confrontando il widget del notebook con l’index.html esportato. Traccia come l’impostazione axes=False viene serializzata e inizializzata; il lavoro è completato quando l’HTML autonomo conserva lo stato degli assi disabilitati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
jupyter, python
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.