Detect when the imshow window is closed using X by user
I would like to know if the user has closed the imshow window using on x
on the right top corner on the window
Simple Code name simplegui.py
import cv2
import numpy as np
fresh_image = np.ones((480,640),np.uint8)
cv2.imshow('image',fresh_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
On clicking x
of imshow window the python code doesn't stop as seen in the screens shot
I would like to python code to stop as soon as user closes the imshow using x
on the right top corner of the window
Anyone help would be helpful.
Thank you for your time.
PS: OpenCV Python: How to detect if a window is closed? non of these solutions work