Thanks guys for your quick replies.

liverpole, the following is an executable code that
will generate an example display of what I want to
save as an image file:

use Tk; use Tk::Photo; use Tk::JPEG; $advisory = 'CAUTION'; $advisoryColor = 'yellow'; @JTA = ('Y','Y','Y','N','N','Y'); @JTAColor = ('green','green','green','yellow','yellow','green'); @IDColor = ('green','green','green','yellow','yellow','yellow','green' +, 'yellow','yellow','green'); @type = ('PAI','PAO','PAS','RAO','RAS','RAI','PAI','RAI','PAS','PAO'); for ($i = 0; $i < 10; $i++) { if ((($i >= 0) && ($i <= 2)) || ($i == 6) || ($i == 9)) { @{$JABText[$i][0]} = ('Y','Y','Y','Y','Y','Y'); @{$JABColor[$i][0]} = ('green','green','green','green','green' +, 'green'); } else { @{$JABText[$i][0]} = ('Y','Y','Y','N','N','Y'); @{$JABColor[$i][0]} = ('green','green','green','yellow','yello +w', 'green'); } @{$JABText[$i][1]} = ('Y','Y','Y','Y','Y','Y'); @{$JABColor[$i][1]} = ('green','green','green','green','green','gr +een'); } # create the GUI display $mw = MainWindow->new(-background => 'black'); $mw->geometry('+0+0'); $mw->title("Info Display"); $f = $mw->Frame(-background => 'black')->pack; $f->Label(-text => 'Advisory', -foreground => 'white', -background => 'black')-> grid(-row => 1, -column => 1, -columnspan => 3, -sticky => ' +w'); for ($i = 0; $i <= 5; $i++) { $f->Label(-text => $i, -foreground => 'white', -background => 'bla +ck')-> grid(-row => 1, -column => $i + 4, -sticky => 'nsew'); } $advisoryLabel = $f->Label(-textvariable => \$advisory, -foreground => $advisoryColor, -background => 'black')-> grid(-row => 2, -column => 1, -columnspan => + 3, -sticky => 'w'); for ($i = 0; $i <= 5; $i++) { $JTALabel[$i] = $f->Label(-textvariable => \$JTA[$i], -foreground => $JTAColor[$i], -background => 'black')-> grid(-row => 2, -column => $i + 4, -sticky => 'nsew'); } $f->Label(-text => 'BREAKDOWN', -foreground => 'white', -background => 'black')->grid(-row => 3, -column => 1, -columnspan => 9, -sticky => 'nsew'); $f->Label(-text => 'ID', -foreground => 'white', -background => 'black +')-> grid(-row => 4, -column => 1, -sticky => 'w'); $f->Label(-text => 'TYPE', -foreground => 'white', -background => 'bla +ck')-> grid(-row => 4, -column => 2, -sticky => 'w'); for ($i = 0; $i <= 5; $i++) { $f->Label(-text => $i, -foreground => 'white', -background => 'bla +ck')-> grid(-row => 4, -column => $i + 4, -sticky => 'nsew'); } for ($i = 0; $i < 10; $i++) { $name = 'station'.$i; $fRow = ($i * 2) + 6; $IDLabel[$i] = $f->Label(-text => $name, -foreground => $IDColor[$i], -background => 'black')-> grid(-row => $fRow, -column => 1, -sticky => 'w'); $typeLabel[$domeIndex] = $f->Label(-textvariable => \$type[$i], -foreground => $IDColor[$i], -background => 'black')-> grid(-row => $fRow, -column => 2, -sticky => 'w'); $f->Label(-text => 'PA:', -foreground => 'white', -background => 'black')-> grid(-row => $fRow, -column => 3, -sticky => 'w'); $f->Label(-text => 'RA:', -foreground => 'white', -background => 'black')-> grid(-row => $fRow + 1, -column => 3, -sticky => 'w'); for ($j = 0; $j <= 5; $j++) { $JABLabel[$i][0][$j] = $f->Label( -textvariable => \$JABText[$i][0][$j], -foreground => $JABColor[$i][0][$j], -background => 'black +')-> grid(-row => $fRow, -column => $j + 4, -sticky => 'nsew'); $JABLabel[$i][1][$i] = $f->Label( -textvariable => \$JABText[$i][1][$j], -foreground => $JABColor[$i][1][$j], -background => 'black +')-> grid(-row => $fRow + 1, -column => $j + 4, -sticky => 'nse +w'); } } # create the menus $menuBar = $mw->Menu; $mw->configure(-menu => $menuBar); $file = $menuBar->cascade(-label => 'File', -tearoff => 0); $file->command(-label => 'Save Display', -command => \&saveDisplay); $file->separator; $file->command(-label => 'Quit', -command => \&closeWindow); MainLoop(); sub saveDisplay { $image = $mw->Photo(-format => 'Window', -data => oct($mw->id)); $filename = 'myimage.jpg'; $image->write($filename, -format => 'JPEG'); } sub closeWindow { $mw->destroy; }

Thanks again for trying to help me out

Zentara, I've seen many references to the Image Magick
that you've mentioned while surfing the net for this
solution. Maybe I should check this out. Thanks!


In reply to Re: Saving Contents of Perl/Tk Display to a File by baklobsters
in thread Saving Contents of Perl/Tk Display to a File by baklobsters

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.