so I got the following code:
import time
from cv2 import cv2
time.sleep(1)
image = cv2.imread("test.png", cv2.IMREAD_GRAYSCALE)
cv2.imshow("image", image)
cv2.setWindowProperty("image", cv2.WND_PROP_TOPMOST, 1)
cv2.waitKey(0)
The program waits for 1 sec and after, it shows the image to me as top most window. When i press any key, the image and the program close. all good so far
but, if i press alt-tab while the program is sleeping(1) (i need to see the image while the focus is on a different window) this is what happens:
The program waits for 1 sec and then, it shows the image to me as top most window. When i press any key nothing happens. if I select/set focus on the image manually and then press any key it closes
i tried this http://www.noah.org/wiki/OpenCV_display_window_on_top_with_focus which describes a similar problem but didn't seem to solve the issue.
so i was wandering if there is a way to activate/set focus the window programmaticaly so when i press any key in the second scenario the window to close without manyally selecting it?