Re: Get Tk::Canvas pixels
"John" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <001401c4d610$618ce160$747882c3@jonsof> |
Well, i use Active perl 5.6.1 so there is not any Tk::WinPhoto installed, and there is not in the activestates repositories either. So, i would like to know how can this be done using Tk::Photo ----- Original Message ----- From: <[email protected]> To: "John" <[email protected]> Cc: <[email protected]> Sent: Monday, November 29, 2004 2:11 PM Subject: Re: Get Tk::Canvas pixels > "John" <[email protected]> wrote: > > Let's assume the code below > > > > -------------------------------------------------------- > > use Tk; > > use Tk::Canvas; > > > > > > my $box = [0, 0, 500, 500]; > > > > my $mw = new MainWindow; > > > > > > my $c = $mw->Scrolled(qw/ > > Canvas -bg white > > -xscrollincrement 1 > > -yscrollincrement 1 > > -confine 0 > > -scrollbars se > > -width 500 > > -height 500/, > > -scrollregion => $box, > > ); > > $c->pack(qw/-fill both -expand 1 -side top/); > > ---------------------------------------------------- > > > > > > > > How the Tk::Photo be applied to the above canvas instance? > > > > > > > > Check out the Tk::WinPhoto manpage. Reading the synopsis should > be enough. You have to use oct($c->id) (or maybe > oct($c->Subwidget("scrolled")->id) instead, and choose the output > format you want. > > Regards, > Slaven > > > > > > > ----- Original Message ----- > > From: <[email protected]> > > To: "John" <[email protected]> > > Cc: <[email protected]> > > Sent: Monday, November 29, 2004 11:51 AM > > Subject: Re: Get Tk::Canvas pixels > > > > > > > "John" <[email protected]> wrote: > > > > Is there any finction or method or a way at least, > > > > that can read the canvas pixels and write them downto > > > > a file? > > > > > > You can use Tk::WinPhoto to take a snapshot of a canvas widget (or > > > any other widget). You get a Tk::Photo object which can be saved > > > as a normal image file (gif, png ...) or inspected through the data() > > > method. > > > > > > Regards, > > > Slaven > > > > > > -- > > > __o Slaven Rezic > > > _`\<,_ slaven <at> rezic <dot> de > > > __(_)/ (_)____ > > > > > ____________________________________________________________________________ > > __ > > > > > > > > > -++**==--++**==--++**==--++**==--++**==--++**==--++**== > > This message was posted through the Stanford campus mailing list > > server. If you wish to unsubscribe from this mailing list, send the > > message body of "unsubscribe ptk" to [email protected] > > > -- > __o Slaven Rezic > _`\<,_ slaven <at> rezic <dot> de > __(_)/ (_)____ > ____________________________________________________________________________ __ -++**==--++**==--++**==--++**==--++**==--++**==--++**== This message was posted through the Stanford campus mailing list server. If you wish to unsubscribe from this mailing list, send the message body of "unsubscribe ptk" to [email protected]