Removed the Base64 encode as it's not required. The raw image data can be passed directly to the Image Element

This commit is contained in:
PySimpleGUI 2022-12-01 13:49:33 -05:00
parent fac982124d
commit d7b16be284
1 changed files with 1 additions and 2 deletions

View File

@ -1,6 +1,5 @@
import PySimpleGUI as sg import PySimpleGUI as sg
import urllib.request import urllib.request
import base64
""" """
Display an Image Located at a URL Display an Image Located at a URL
@ -19,7 +18,7 @@ import base64
image_URL = r'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png' image_URL = r'https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png'
layout = [[sg.Image(base64.b64encode(urllib.request.urlopen(image_URL).read()))]] layout = [[sg.Image(urllib.request.urlopen(image_URL).read())]]
window = sg.Window('Image From URL', layout) window = sg.Window('Image From URL', layout)