How can I constantly display an image at same location, while it is being edited by the code?

How can I constantly display an image at same location, while it is being edited by the code?

I wish to follow what the code is doing in the image, while it is doing it.
The image should then be displayed at the same place, not constantly shown as a new copy.

I am using Jupyter notebook.


I don’t think that is possible. Is there an application you need this for, or do you just want to better understand what each line does? If the latter, just hide parts of the code in if/else blocks and move the else down progressively.

I’m starting writing an app project that modifies an image. I want to be able to see the image somewhere on my computer, while changes are being done in it. In other words, constantly update the image display in the same viewport, so I can see the evolution in the image, rather that constantly comparing 2 images for seing the has has changed. So far, the app shows the image in a image viewer, But it does not put tha window in front of the other windows on my desktop and in constantly opens a new image, so previous images accumulate (one opened, 2nd opened, 3rd opened, and so on.

Does this help? Animated image using a precomputed list of images — Matplotlib 3.6.3 documentation

Thanks for your reply. But I’m looking for displaying again and again, at the same position on the screen the same image in memory, but an image that is changing, because the code is modifying it. Changes would not be computing intensive. I would do things such as changing pixel colors. I would just need to refresh the display every while in the code.

Do I really need to generate a different (one more) image every let’s say 1 sec? The problem would be the same: I want to display the new updated image at the same location than the previous state of the image. Also, the image would come from the same image in memory.

Perhaps Animations using Matplotlib — Matplotlib 3.7.0.dev1603+g81f5f24c48 documentation