Ask coding questions

← Back to all posts
Is it possible to use PIL in to show images?

It seems PIL can no longer be imported from "regular" Python repls.
It can be imported in Tkinter repls but produces no output.
Is there a way to make this work, i.e. display an image in the output window?

Answered by Scoder12 [earned 5 cycles]
View Answer

If you save the image to a file using'whatever.png') (with whatever filename you want), then it should pop up below the console, even if it doesn't you can click on it and view it.


@Scoder12 thank you for your reply. I have read about this workaround in older posts, but I was just wondering whether this might have been resolved in the meantime. is now able to display graphics in the Tkinter, Pygame and Turtle "flavours", so I was hoping that would also somehow work.


@boukeas oh ok. The way that works is by saving the file to a temporary filename and calling xv to show the image, which requires the X window system to be running, which is not. If you want to show the image via Tkinter or Pygame you would probably have to implement that yourself rather than using show().