Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

In Python, poll with cv2.getWindowImageRect(windowName). It will return (-1, -1, -1, -1) when the user clicks the window close button.

# check if window was closed or image was resized

xPos, yPos, width, height = cv2.getWindowImageRect(windowName)

if xPos == -1: # if user closed window
    pass # do whatever you want here if the user clicked CLOSE