1

I can see an image, but I made a function to make changes to the array of that image (called next_step) and I want to see changes of that image trough ipywidgets while I control the parameters, but the problem is that the image is displayed multiple times while I would like to refresh it only.

enter image description here

enter image description here

This is the code:

def blur(t, c):
    steps = int(t / delta_t)

    sol = []

    sol.append(image)

    for i in range(steps):
        sol.append(next_step(sol[-1], c))

    clear_output()
    plt.imshow(sol[-1])

And the other one:

from IPython.display import clear_output
from ipywidgets import widgets

interact(blur, t=widgets.FloatSlider(min=t_min, max=t_max, step=delta_t), c=widgets.FloatSlider(min=0.1, max=1, step=0.1))

How can I update/refresh the image instead of printing it several times with ipywidgets?

Patricio Sard
  • 2,092
  • 3
  • 22
  • 52

0 Answers0