compatible image type

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Jul 4 05:50:50 EDT 2008


On Fri, 04 Jul 2008 01:15:30 -0700, gordon wrote:


> then later on i want to create a Photoimage using
> 
> ImageTk.PhotoImage(file=pathname) and display it on a canvas.
> 
> the extn can be anything ..even zip or bat ,doc whatever depending on
> user selection...I want to put someway to raise an error message to
> the user if he selects a file with extension not of a compatible image
> type for PhotoImage.How should i do this? should i check 'extn' to a
> list of compatible image type extensions(something like
> [''jpg','jpeg','png','gif'...] )  or is there a better way?

Just catch the exception raised by `PhotoImage` if a non compatible file
was selected!?

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list