Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,6 +1,4 @@
|
|||
import PySimpleGUI as sg
|
||||
# import PySimpleGUIQt as sg
|
||||
# import PySimpleGUIWeb as sg # has a known flicker problem that's being worked
|
||||
import cv2
|
||||
|
||||
"""
|
||||
|
@ -10,10 +8,10 @@ import cv2
|
|||
in PySimpleGUIQt (yet).
|
||||
"""
|
||||
|
||||
sg.ChangeLookAndFeel('Black')
|
||||
sg.change_look_and_feel('Black')
|
||||
|
||||
# define the window layout
|
||||
layout = [[sg.Image(filename='', key='_IMAGE_', tooltip='Right click for exit menu')],]
|
||||
layout = [[sg.Image(filename='', key='-IMAGE-', tooltip='Right click for exit menu')],]
|
||||
|
||||
# create the window and show it without the plot
|
||||
window = sg.Window('Demo Application - OpenCV Integration', layout, location=(800,400),
|
||||
|
@ -23,9 +21,11 @@ window = sg.Window('Demo Application - OpenCV Integration', layout, location=(80
|
|||
# ---===--- Event LOOP Read and display frames, operate the GUI --- #
|
||||
cap = cv2.VideoCapture(0) # Setup the OpenCV capture device (webcam)
|
||||
while True:
|
||||
event, values = window.Read(timeout=20, timeout_key='timeout')
|
||||
event, values = window.read(timeout=20)
|
||||
if event in ('Exit', None):
|
||||
break
|
||||
ret, frame = cap.read() # Read image from capture device (camera)
|
||||
imgbytes=cv2.imencode('.png', frame)[1].tobytes() # Convert the image to PNG Bytes
|
||||
window.FindElement('_IMAGE_').Update(data=imgbytes) # Change the Image Element to show the new image
|
||||
window['-IMAGE-'].update(data=imgbytes) # Change the Image Element to show the new image
|
||||
|
||||
window.close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue