From e1d6f308227a1014e3ac8edfd69e00da984ca598 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 5 Dec 2012 02:17:17 +0000 Subject: handle errors opening image file and try to report them to the Pd window svn path=/trunk/externals/moonlib/; revision=16649 --- image.tcl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 image.tcl (limited to 'image.tcl') diff --git a/image.tcl b/image.tcl new file mode 100644 index 0000000..7f4f22c --- /dev/null +++ b/image.tcl @@ -0,0 +1,15 @@ + +namespace eval ::moonlib::image:: { +} + +proc ::moonlib::image::configure {obj_id img filename} { + if { [catch {$img configure -file $filename} fid]} { + ::pdwindow::logpost $obj_id 1 "[image]: error reading '$filename':\n$fid\n" + } +} + +proc ::moonlib::image::create_photo {obj_id img filename} { + if { [catch {image create photo $img -file $filename} fid]} { + ::pdwindow::logpost $obj_id 1 "[image]: error reading '$filename':\n$fid\n" + } +} -- cgit v1.2.1