title: Python OpenCV - Update camera index of live webcam view
body: <p>I am viewing a webcam camera live feed. I would like to incorporate this into a Tkinter GUI and have a dropdown selection that allows one to change the camera index, and therefore the webcam being used, on the fly.
  How can this be achieved?</p>
  
  <p>Example code:</p>
  
  <pre><code>import cv2
  
  def show_webcam(mirror=False):
      cam = cv2.VideoCapture(0)
      while True:
          ret_val, img = cam.read()
          if mirror: 
              img = cv2.flip(img, 1)
          cv2.imshow('my webcam', img)
          if cv2.waitKey(1) == 27: 
              break  # esc to quit
      cv2.destroyAllWindows()
  
  def main():
      show_webcam(mirror=True)
  
  if __name__ == '__main__':
      main()
  </code></pre>