title: Window freezing even after using waitKey() and destroyAllwindows() in Opencv
body: <p><strong>ENVIRONMENT</strong></p>
  
  <p>OS- mint Linux,
  using opencv3.1,using spyder through anaconda</p>
  
  <p><strong>ISSUE</strong></p>
  
  <p>The code mentioned below opens a window of name frame and display the video captured through laptop camera.But when I press 'q', as mentioned in code, it should stop and terminate the window. But,here the window stops to display any further frames captured and do not terminates.then manually I force Quit the process.</p>
  
  <p>What is the problem, why is it not terminating the window?</p>
  
  <p><strong>CODE:-</strong></p>
  
  <pre><code>import cv2
  
  import numpy as np
  
  cap = cv2.VideoCapture(0)
  
  while(True):
  
          ret, frame = cap.read()
  
          cv2.imshow('frame',frame)
          if cv2.waitKey(1) &amp; 0xFF == ord('q'):
              break
  
  cap.release()
  
  cv2.destroyAllWindows()
  </code></pre>