Merge pull request #1673 from PySimpleGUI/Dev-latest

Changed how image is created before updating the Image Element. Now i…
This commit is contained in:
MikeTheWatchGuy 2019-07-09 14:14:51 -04:00 committed by GitHub
commit 294102b360
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -57,10 +57,16 @@ def main():
slider_elem.Update(cur_frame)
cur_frame += 1
imgbytes = cv.imencode('.png', frame)[1].tobytes() # ditto
image_elem.Update(data=imgbytes)
"""
# This was another way updates were being done, but seems slower than the above
img = Image.fromarray(frame) # create PIL image from frame
bio = io.BytesIO() # a binary memory resident stream
img.save(bio, format= 'PNG') # save image as png to it
imgbytes = bio.getvalue() # this can be used by OpenCV hopefully
image_elem.Update(data=imgbytes)
"""
main()