PysimpleGui sg. Image() always reports errors when importing pictures. Is there any solution

Time:2021-12-29

When using pysimplegui to try to display pictures on the window, I encountered the problem that I can’t recognize the pictures. Please teach me the solution.

The source code is as follows:

import PySimpleGUI as sg
file = r'C:\Users\Administrator\PycharmProjects\createword\venv\picture\aaa.png'
layout = [[sg.Image(filename=file)]]
window = sg.Window('hh',layout = layout).Finalize()

b,c = window.read()

Errors are reported as follows:

PysimpleGui sg. Image() always reports errors when importing pictures. Is there any solution

Ball pull

This work adoptsCC agreement, reprint must indicate the author and the link to this article