OpenCV comes with cv.setMouseCallback(window, callback_function)
method allowing to register a function handling mouse events, so handling mouse events does not require a while loop asking for the events.
Is there an OpenCV method or another approach which will allow to register a function handling keyboard events, so that there is no need for a while True: key = cv.waitKey() ...
?
And, yes, I am aware of https://stackoverflow.com/questions/52010883/opencv-set-a-vcallback-for-keyboard-event#52011455 question here on stackoverflow, but it relates to C++ and doesn't have an accepted answer, so my question isn't a duplicate of that one. And I have searched the Internet, but haven't yet found anything helpful to see if there is a way to achieve what I am asking for or not.