http://qs1969.pair.com?node_id=185786

PyroX has asked for the wisdom of the Perl Monks concerning the following question:

I searched on google, and here, no ansewers yet.

I want to build a simple gui with perl backend, the best example to describe why, I want to make a perl+Tk app to run through directories and list movies, and match the titles to pictures of them.

I need to be able to display the images, can I do this with perl and Tk? I have been using perl for awhile, but have never used Tk.

Anyone know of any tutorials or sample code to display an image with perl / Tk , or will I need some other things in addition?

I have multiple uses for this, ie: mp3's, MAME Games, movies, ect ect. And would like to get it done. ( I have built the untimate set-top box and neet to make the interface for browsing titles on the screen. )

Please help if you can ;)

Replies are listed 'Best First'.
Re: Tk, images, where do I begin.
by clintp (Curate) on Jul 28, 2002 at 00:33 UTC
    Little bit to get you started:
    use Tk; use Tk::Photo; my $mw=new MainWindow; my $foto=$mw->Photo(-file => 'picture.gif'); $mw->Button(-image => $foto)->pack(); $mw->MainLoop;
    I could have attached the $foto object to any widget that will take a -image option (i.e. Label) or a canvas (with createImage()).
Re: Tk, images, where do I begin.
by Chmrr (Vicar) on Jul 28, 2002 at 05:50 UTC

    I would suggest:

    Myself, I found the widget examples to be the most useful.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Re: Tk, images, where do I begin.
by jdavidboyd (Friar) on Jul 28, 2002 at 00:06 UTC
    I would start (and, in fact, did), by going to Amazon.com or Barnes & Noble and getting a copy of Mastering Perl/TK.
    It was around $50, and is money well spent.
    It will answer all your questions.

    There is also a Perl/TK web page, but I don't recall the adress of it.
    Dave
Re: Tk, images, where do I begin.
by hiseldl (Priest) on Jul 28, 2002 at 07:00 UTC
    I wrote some code for another monk last week, click here to check it out. It is a script with a left frame for directories, and a few widgets on the right that contain images. Look for the $im{ONE} and $im{GROUP} references for the image specific code (%im is the image hash).

    --
    hiseldl