title: How to fix the error "QObject::moveToThread:" in opencv in python?
body: <p>I am using opencv2 in python with the code</p>
  
  <pre><code>import cv2
  cv2.namedWindow("output", cv2.WINDOW_NORMAL)       
  cv2.imshow("output",im)
  cv2.resizeWindow('output', 400,400)
  cv2.waitKey(0)
  cv2.destroyAllWindows()
  </code></pre>
  
  <p>I have the error as </p>
  
  <pre><code>QObject::moveToThread: Current thread (0x1d2c9cf0) is not the object's thread (0x1d347b20).
  Cannot move to target thread (0x1d2c9cf0)
  </code></pre>
  
  <p>I debug and found that it happened when I use <code>cv2.waitKey(0)</code>. How should I fix it? Thanks</p>
  
  <p>Update: I am using 3.3.0.0. If I use older version, I have error</p>
  
  <pre><code>OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvDestroyAllWindows, file /io/opencv/modules/highgui/src/window.cpp, line 577
  Traceback (most recent call last):
    File "tools/demo_handbone.py", line 220, in &lt;module&gt;
      demo(net, im_name)
    File "tools/demo_handbone.py", line 159, in demo
      cv2.destroyAllWindows()
  cv2.error: /io/opencv/modules/highgui/src/window.cpp:577: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvDestroyAllWindows
  </code></pre>