Search code examples
pythonimagematplotlibtimerfrequency

Efficient way of flashing images in python


What would the most efficient way of flashing images be in python?

Currently I have an infinite while loop that calls sleep at the end, then uses matplotlib to display an image. However I can't get matplotlib to replace the current image, I instead have to close then show again which is slow. I'd like to flash sequences of images as precisely as possible at a set frequency.

I'm opens to solutions that use other libraries to do the replacement in place.


Solution

  • Using a library called PsychoPy. It can guarantee that everything is drawn and allows you to control when a window is drawn (a frame) with the window.frame() function.