More "Demo Program Catchup" updates. Working through them bit by bit.....

This commit is contained in:
PySimpleGUI 2022-02-22 05:20:03 -05:00
parent 1eb653d910
commit f1e0c7d03f
9 changed files with 87 additions and 57 deletions

View file

@ -1,4 +1,7 @@
import cv2, PySimpleGUI as sg
window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(key='-IMAGE-')], ], location=(800, 400)), cv2.VideoCapture(0)
# Make the window
window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(filename='', key='image')], ], location=(800, 400)), cv2.VideoCapture(0)
# Loop reading video frames
while window(timeout=20)[0] is not None:
window['-IMAGE-'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes())
# Read a video frame and write it to the window
window['image'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes())