I just started to learn OpenCV with Python for Raspberry Pi 3. I wrote a simple code for namedWindow(). The problem is destroyWindow() does not work as I expect. The "TEST" window is still there. What is wrong with the following code?
import cv2
import sys
if __name__ == '__main__':
cv2.namedWindow("TEST")
while True:
key = cv2.waitKey(5)
if key == 27:
print "ESC pressed..."
cv2.destroyWindow("TEST")
break
sys.exit()