The webcam window doesn't seem to close when any key is pressed including the "ESC" key?
Here is an excerpt from the Flet app:
cap = cv2.VideoCapture(0)def main(page : ft.Page): page.title = "fletCam" def update_images(): while(cap.isOpened()): # Capture frame-by-frame ret, frame = cap.read() if ret == True: # encode the resulting frame jpg_img = cv2.imencode('.jpg', frame) b64_string = base64.b64encode(jpg_img[1]).decode('utf-8') image_box.src_base64 = b64_string page.update() k = cv2.waitKey(0) & 0xFF if k == 27: # close on ESC key cv2.destroyAllWindows() else: break time.sleep(1/115) cap.release() cv2.destroyAllWindows()
I'm running this application on Windows 11