[Tutor] Displaying .jpg in Tkinter (Python 3.1)
dirk at pensiun.com
Mon Aug 31 15:55:23 CEST 2009
with Tkinter, you can only display GIF and PGM/PPM images.
when you try to create an PhotoImage object from another file format
(JPG for example), it will give you an error.
Alan Gauld wrote:
> "Dirk Wangsadirdja" <dirk at pensiun.com> wrote
>> is there anyway to display a .jpg (or other type) images in Tkinter
>> with Python 3.1?
> You can display a limited set of image types, including GIF and
> JPG in Tkinter without PIL. Several Widgets take an image including
> the Canvas and Text widgets. I think a label can be an image too,
> but am not certain.
> The trick is to crate an PhotoImage object from your file and insert that
> into the widget. To change the widget you modify the image object
> not the widget.
> See here for more info:
More information about the Tutor