Time Dependent Clipboard Image Error

I am trying to capture the displayed image of a Python based program, and I
can do that with this code...

...this works, but I have a wait time hard coded in, and 0.2 seconds works
reliably on my system, but I expect it might not always for everyone. If I
lower the wait time, it is more and more likely to get this error...

I tried putting a check for the existence of the file before opening the
clipboard, and that did not work. So it seems like there is some amount of
time between when the file is generated and when it becomes a usable PNG
file.

Do you have any suggestions on how to handle that time dynamically instead
of just picking an arbitrary wait time?

ยทยทยท

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Time-Dependent-Clipboard-Image-Error-tp5717043.html
Sent from the wxPython-users mailing list archive at Nabble.com.