I’m using interact for an interactive graph network visualization, where moving a slider recolors nodes. When I move the slider, the image disappears for a moment as the new graph is rendered and displayed, during which time the frame goes white. Is there anyway to retain the previous frame until the new frame has loaded, so I can move the slider smoothly without the constant flickering whenever the image updates? To be clear, I do want it to update every time the slider moves (so disabling continuous update is not the solution), but just to do so smoothly without the image going white between the previous and new output.
I believe your only options are:
- use a graphing library that works with ipywidgets (eg, bqplot)
- use an output widget and fix the width and hight - this usually solves the
jumpingissue people have, though I am not sure you are experiencing that as you just mentioned a blanking issue.
If it is not either of those two issues - could you perhaps post a minimal reproducible example that people can try out and experiment with?
Another approach: instead of relying on the
Output widget behavior baked into
interact, you can manage your own display handle:
def do_something(x): return x # --- another cell --- @interact def foo(x=(0,10)): display_handle.update(do_something(x)) display_handle = display(do_something(x), display_id=True)
This will look the same as a regular interact (controls above, output below) and will even survive Create new view for output in JupyterLab.
While developing, this also has the benefit of separating your implementation from the display details… and would even let you modify
do_something on the fly, use