Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

freash_image = np.ones((480,640),np.uint8)

cv2.imshow('image',freash_image)
cv2.waitKey(0)
cv2.destroyAllWindows()

On clicking x of imshow window the python code doesn't stop as seen in the screens shot

image description

image description

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.

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

freash_image fresh_image = np.ones((480,640),np.uint8)

cv2.imshow('image',freash_image)
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

image description

image description

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. time.

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

image description

image description

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

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

image descriptionimage description

image description

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

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

image descriptionimage description

image description

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