My apps opens with showing some windows. I want all windows to close if one of them is closed by the users. How to do so?
do you have any actual “users” ? shouldn’t you concentrate on developing kick-ass computer vision algorithms instead of worrying about “user interface” ?
i promise you – none of this will be relevant, a month later …
and oh, ofc, there is destroyAllWindows()
Clicking one by one is a tedious job because I have to concentrate on creating new algorithms.
exit your program using a key, such as ESC, or any key really. detect that by checking
highgui doesn’t pass window closing events along, so it is a bad idea to close imshow windows using the [X] button or Alt+F4.
Yes. I know but I don’t know how to use it to close all windows if one of them is closed.
Edit: I see. I can close by pressing ESC. Thank you all !!!
your two options:
- live with
highgui's design scope
- use a GUI toolkit and make your own GUI
I did show you how to handle key presses using
waitKey() in the other thread. your C++ translation dropped that functionality.
if you do precisely that, all windows will be closed, and the next
waitKey() will never return, because there are no windows anymore that could cause any events, not even key events.
you’ll notice when you run that code.
Thank you. I think your suggestion (by pressing ESC) is enough to close all windows.