Forum Archive

A good way to handle ImageView.load_from_url when loading the same url

gendalus

Hi everybody,

in a script that works like a digital picture frame I'm using the ImageView.load_from_url and I'm running into some problems.

The script is running on a loop, fetches picture posts from an API an displays them. The problem starts when a URL shows up a second time. Loading a picture that has been loaded before causes Pythonista to freeze.

It is totally possible to store the reference to the loaded image using

pictures[url] = image_view.image

in the next cycle of the loop. But there's some bookkeeping to be done to know what was the URL of the last loaded url …

So now I'm wondering if there's another way of doing it, that is more straight forward. I thought of something like a callback when the image has been downloaded, but I would not know how to do that. Is there something I'm missing?

Phuket2

@gendalus , sorry I can't not answer your question directly. But if you search the forum for something like 'from_url' you will see a number of issues ppl have had before using this method with work arounds.