Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

60 lines of Perl code, but I don't have the text portion, so it is now the time for you to modify it:

use Tk; use Tk::JPEG; use File::Glob ':glob'; my $automode = 0; my @jpgs = bsd_glob("9???.jpg"); my $index = -1; my $mw = MainWindow->new(title => "JPEG"); $mw->geometry("800x800"); my $f = $mw->Frame()->pack(-fill => "both"); $f->Button(-text => "Load", -command => \&load)->pack(-side => "left", + -fill => "both"); my $pattern = $f->Entry(-width => 10, -text => '*')->pack(-side => "le +ft", -fill => "both"); my $step; $f->Button(-text => "<<", -command => sub {prev_image($step->get())})- +>pack(-side => "left", -fill => "both"); $f->Button(-text => "<", -command => sub {prev_image(0)})->pack(-side +=> "left", -fill => "both"); $step = $f->Entry(-width => 3, -text => 10)->pack(-side => "left", -fi +ll => "both"); $f->Button(-text => ">", -command => sub {next_image(0)})->pack(-side +=> "left", -fill => "both"); $f->Button(-text => ">>", -command => sub {next_image($step->get())})- +>pack(-side => "left", -fill => "both"); $f->Checkbutton(-text => "Auto Mode", -onvalue => 1, -offvalue => 0, - +variable => \$automode, -command => sub {if ($automode) {print $autom +ode; next_image()}})->pack(-side => "left", -fill => "both"); $f->Label(-text => "Delay")->pack(-side => "left", -fill => "both"); my $delay = $f->Entry(-width => 4, -text => 1000)->pack(-side => "left +", -fill => "both"); $f->Label(-text => "milli-second(s)")->pack(-side => "left", -fill => +"both"); my $image = $mw->Photo(); next_image(0); my $button = $mw->Label(-image => $image)->pack(-side => "top", -fill +=> "both"); MainLoop; sub load { @jpgs = bsd_glob($pattern->get()); $index = -1; next_image(0); } sub next_image { $index += shift; $index = $#jpgs if ($index > $#jpgs); while ((($index + 1)<= $#jpgs) && !eval {$image->read($jpgs[++ $in +dex], -shrink); 1}) { } if ($automode) { $mw->after($delay->get(), \&next_image) if (($index + 1) <= $# +jpgs); } $mw->configure(-title => $jpgs[$index]); $std = undef; } sub prev_image { $index -= shift; $index = 0 if ($index < 0); $automode = 0; while ((($index - 1) >= 0) && !eval {$image->read($jpgs[-- $index] +, -shrink); 1}) { } if ($index >= 0) { $mw->configure(-title => $jpgs[$index]); $std = undef; } }

In reply to Re: Using Perl to create a PowerPoint presentation by pg
in thread Using Perl to create a PowerPoint presentation by watcher@LBK

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-19 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found