Hi,

I am experiencing a problem that I canno't solve.
It's about the data of the copy method in Tk::Photo.
Sorry for the length: I canno't have readmore tags working. Bad day.
Here a sample script:
use Tk; use strict; # a nice and stolen pic my $dilbert = <<"EOXPM"; /* XPM */ static char *smalldilbert[] = { " 16 16 14 1", /* colors */ "` c #000000", ". c #380000", "# c #383800", "a c #383838", "b c #790000", "c c #793838", "d c #797938", "e c #797979", "f c none", "g c #bebe38", "h c #bebe79", "i c #ffff79", "j c #bebebe", "k c #ffffff", /* pixels */ "fff`dd##aadd`fff", "ffff`iiiiii`ffff", "ffff`iiiiii`ffff", "ffff`ihghgi`ffff", "fff``deeeed``fff", "fffdaiededi#dfff", "fffa`iighii`#fff", "ffff`idiidi`ffff", "ffff`igddhi`ffff", "ffff`iiiiii`ffff", "ffff`iiiiii`ffff", "ffffaeedddeaffff", "fff`eee.`eee`fff", "ff`jjck.bkkkj`ff", "f`jkb.a.`kkkkj`f", "`jjj``...kkkjjj`" }; EOXPM # making a empty image my $mw = MainWindow -> new; my $label = $mw->Label ()->pack; my $image = $label ->Photo('image', -height => 10, -width => 10, -format=>'XPM'); $label->configure(-image => $image); my $data_mw = $image->data(-format => 'XPM'); # so what we have? print "$data_mw\n"; # this is ok # now making a dilbert image my $top = $mw ->Toplevel; my $label_1 = $top -> Label()->pack; my $image_1 = $label_1 ->Photo('image', -data=> $dilbert, + -format=>'XPM'); $label_1->configure(-image => $image_1); # copying the dilbert inside the empty one # MainLoop auto-update... $image -> copy($image_1); my $data_copy = $image->data(-format => 'XPM'); print $data_copy; # the above print something like # Tk::Photo=HASH(0xc5ef04) # How can I access this data? # Not the original but the copy MainLoop;

Thank for any help.

didier.

In reply to Tk::Photo and copy method by didier

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.