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

Voila does not support IPython's update_display #1259

Open
patfrench opened this issue Nov 16, 2022 · 1 comment
Open

Voila does not support IPython's update_display #1259

patfrench opened this issue Nov 16, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@patfrench
Copy link

Description

Hi
I have 2 problems with my SVG.

  1. I have one slider and one SVG, the slider change the text in my SVG with lxml. In my cell notebook it's OK ! but in voila my SVG does not change
  2. On my VPS, my SVG is black

Here is the code that causes the problem

Thank you

Reproduce

<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" width="50mm" height="50mm" viewBox="0 0 50 50" version="1.1" id="svg5">
  <defs id="defs2"/>
  <g id="layer1">
    <rect style="fill:#aaeeff;stroke:none;stroke-width:0.499999;stroke-dasharray:1.63028, 0.815139" id="rect234" width="50" height="50" x="0" y="0" rx="0.052267302"/>
    <text xml:space="preserve" style="font-size:12.7px;font-family:Calibri;-inkscape-font-specification:Calibri;fill:#000000;stroke:none;stroke-width:0.499999;stroke-dasharray:1.63028, 0.815139" x="18.358545" y="27.116667" id="text1108"><tspan id="tspan1106" style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.7px;font-family:Calibri;-inkscape-font-specification:'Calibri Bold';fill:#000000;stroke-width:0.5" x="18.358545" y="27.116667">25</tspan></text>
  </g>
</svg>
import ipyvuetify as v
from ipywidgets import jslink, Image, Output
from IPython.display import SVG, HTML, display, clear_output, DisplayHandle, Image, update_display,Code
from lxml import etree, html
from threading import Timer
def update_display(valeur_a_afficher):
    val = valeur_a_afficher
    boarder = etree.parse('test.svg')
    b = boarder.iter()
    for data in b:
        if data.attrib.get('id') == "tspan1106":
            data.text = str(val)
            etree.tostring(data)
    boarder.write('test.svg', pretty_print=True, xml_declaration=False,   encoding="utf-8")
    

def on_click(widget, event, data):
    update_display(str(0))
    image.update(SVG(filename='test.svg'))
    #image.update(HTML('<img " src="I-TRANS2.svg"  width="500" height="600">'))
    
def on_incr(widget, event, data):
    global itrans
    update_display(str(widget.v_model))
    image.update(SVG(filename='test.svg'))
    #image.update(HTML('<img " src="I-TRANS2.svg"  width="500" height="600">'))
    
    
button1 = v.Btn(color='primary',children=['RESET AFF'])
button1.on_event('click', on_click)

slider = v.Slider(v_model=50)
slider.on_event('click', on_incr)



image = display(SVG(filename='test.svg'),display_id=True)
#image1 = display(HTML('<img " src="I-TRANS2.svg"  width="500" height="600">'),display_id=True)

v.Layout(class_='pa-2', children=[button1,slider])
  1. In my notebook it'ok
  2. image
  3. In voila (on my personnal computer) the SVG does not update
  4. On my VPS

image

Expected behavior

Context

  • voila version 0.2.16 on my personnal computer
  • windows 10
  • voila version 0.4.0 on my VPS
  • ubuntu

If using JupyterLab

  • jupyter version on my PC
    IPython : 7.22.0
    ipykernel : 5.3.4
    ipywidgets : 7.6.3
    jupyter_client : 6.1.12
    jupyter_core : 5.0.0
    jupyter_server : 1.4.1
    jupyterlab : 3.0.14
    nbclient : 0.5.3
    nbconvert : 6.0.7
    nbformat : 5.7.0
    notebook : 6.3.0
    qtconsole : 5.0.3
    traitlets : 5.5.0

  • jupyter version on my VPS
    IPython : 8.6.0
    ipykernel : 6.17.1
    ipywidgets : 8.0.2
    jupyter_client : 7.4.1
    jupyter_core : 5.0.0
    jupyter_server : 1.23.2
    jupyterlab : 3.5.0
    nbclient : 0.7.0
    nbconvert : 7.2.5
    nbformat : 5.7.0
    notebook : 6.5.2
    qtconsole : 5.4.0
    traitlets : 5.5.0

Thank you

@patfrench patfrench added the bug Something isn't working label Nov 16, 2022
@martinRenou
Copy link
Member

martinRenou commented Aug 3, 2023

Thanks for opening an issue. By design, update_display (what display(display_id=...) does under the hood) cannot work in Voila for now. We may want to support it though.

@martinRenou martinRenou changed the title Bug with SVG : does not change with voila on my computer and on my VPS my SVG is black Voila does not support IPython's update_display Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants