Gentle People,

After posting an initial question wondering about a useful image viewer, I was vectored off to look at the Perl Tk and presented with an example script that worked a treat. However, in the search for a less capable (and therefore smaller and less complex) piece of code, I cobbled together the script shown below.

(This is a good place for a disclaimer—I know next to nothing about Perl Tk and still consider myself a Perl duffer even with a couple of years of medium intensity experience.)

In any case, this code isn’t quite there. I would like it to display an image then over write it with a subsequent image. This actually displays an image and writes the next image below the previous one (not behind the current image, below it on the monitor) with each subsequent image drawn, I suppose, further down and out of sight. This is running on a Windows machine using Active State Perl.

Many thanks, folks.

#!/usr/local/bin/perl use Tk; use Tk::Photo; $mw = new MainWindow; $mw -> geometry ("820x780"); @files = <*gif>; for $image (@files) { $shot = $mw->Photo(-file => "$image"); $mw->Button(-image => $shot)->pack(); $mw->update; select(undef, undef, undef, .1); } $mw->MainLoop;

In reply to Image in Perl TK? by hill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.