Opencv imread() a picture can't be closed on Mac

my opencv using imread() to read an imagem, it shows the image and zoom in and out upper right the corner, however the close icon disappears. The image will be closed only if I closed my VScode. does anyone encounter the same problem and how do you solve it?
thanks!

Can you show us your code?

a screenshot of that whole situation would be helpful as well

Hello, what is the resolution of the image? If the resolution gets bigger than your screen you may lost the ability to drag until the “close”.

I don’t know I think it’s very high any I think

import cv2 as cv

import numpy as np

import matplotlib.pyplot as plt

import sys

img = cv.imread(“bird.jpg”,)

cv.imshow(“bird”,img)

cv.waitKey()

that’s all the code, then, it lost close icon.

I tried an image of 710*315 resolution, but it still the same.

Try to put a zero inside the waitKey(0);

I have tried 0,1,empty. none of them work.

cv2.destroyAllWindows()

That works?

Or even:

k = cv2.waitKey(33)
    if k==27:    # Esc key to stop
        break

reference.

it’s not a problem to stop it, I can press any key while put mouse over the image to stop show it. the question is how to let the close icon appear.

OpenCV doesn’t have this feature. It handles key presses by default.
You can use Qt if you need to use window handler.

can you specify it? not sure what do you mean. what Qt means?