voila
voila copied to clipboard
Updating widgets in voila behaves differently than jupyterlab (voila flashes for a few seconds)
Very simple app One button, one Table. If you click the button in refreshes the table If you run it Jupyterlab it works fine and the table is updating without flashing If you run it in voila the table gets updated but it disappears for a second before reappearing.
import pandas as pd
import numpy as np
import ipywidgets as w
from ipydatagrid import DataGrid
def make_grid(rows=20, cols=2):
df = pd.DataFrame(np.random.uniform(size=(rows, cols))).round(2)
return DataGrid(df)
btn1 = w.Button(description='click me')
cont1 = w.HBox([make_grid()])
def on_click_update1(event):
grid = make_grid()
cont1.children[0].data = grid.data
btn1.on_click(on_click_update1)
b1 = w.VBox([btn1, cont1])
Thanks @gioxc88 for reporting the issue. Since ipydatagrid
is not working yet with the current main
branch of Voila (https://github.com/bloomberg/ipydatagrid/pull/369). I will wait for the update of ipydatagrid
before addressing this issue.
@gioxc88, I did not see the versions you are using.
I just tested this on my server with voila = 0.4.0 ipydatagrid =1.1.13
The table updates, on the button press, without any flickering in voila.
Here is a screen recording: