OpenCV DestroyWindow doesn't work on Ubuntu. How to close a window correctly?

Viewed 4021

In the following code, DestroyWindow or DestroyAllWindows can't close the window opened by ShowImage. When I tried to close it by clicking the close button, the window suspended. After killing the window, the whole IDLE closed.

import cv
image = cv.LoadImage("../lena.bmp", 0)
cv.NamedWindow("test")
cv.ShowImage("test", image)
cv.WaitKey()
cv.DestroyWindow("test")  #or cv.DestroyAllWindows()

I'm using OpenCV 2.4.2 with Python 2.7 on Ubuntu 12.04 LTS.

Am I did something wrong and how can i close the window create by ShowImage?

2 Answers
Related