title: opencv.imshow will cause jupyter notebook crash
body: <p>I check other question on google or stackoverflow, they are talking about run cv2.imshow in script, but my code run in jupyter notebook.</p>
  
  <p>Here is my configuration:</p>
  
  <ol>
  <li><p>ubuntu 16.4x64</p></li>
  <li><p>python 3.5</p></li>
  <li><p>opencv 3.1.0</p></li>
  </ol>
  
  <p>I start a jupyter notebook: here is the code I put it notebook:</p>
  
  <pre><code>%pylab notebook
  import cv2
  
  cvim2disp = cv2.imread('data/home.jpg')
  cv2.imshow('HelloWorld', cvim2disp)
  cv2.waitKey() #image will not show until this is called
  cv2.destroyWindow('HelloWorld') #make sure window closes cleanly
  </code></pre>
  
  <p>When I execute these code. image will show in a pop up window, but I can not close this window by clicking the x on the top right corner, and a moment later, system will prompt me that the window is not responding, it will give me 2 choices: "wait" , "fore quit". if I hit wait, then It will show the same prompt later, If I hit 'fore quit', then the jupyter notebook kernel die and I have to start over.</p>
  
  <p>I google around, many solution suggest that I should add this code </p>
  
  <pre><code>cv2.startWindowThread()
  </code></pre>
  
  <p>before <code>imshow</code>, but situation get worse, the kernel hang forever!. 
  anybody have some idea what's going on.</p>
  
  <p>Here is the pic of my error:
  <a href="https://i.stack.imgur.com/OzI8h.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OzI8h.png" alt="enter image description here"></a></p>