Skip Menu |

This queue is for tickets about the Imager-Screenshot CPAN distribution.

Report information
The Basics
Id: 32843
Status: resolved
Priority: 0/
Queue: Imager-Screenshot

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.005
Fixed in: (no value)



Subject: Taking a screenshot from a non-toplevel Tk widget fails
I know that the "widget" option is not documented. Even so, here's a report regarding this option. The following one-liner fails $ perl -MImager::Screenshot=screenshot -MTk -e '$l=tkinit->Label(-text => "hello, world")->pack;$l->update;screenshot(widget => $l)' wrong # args: should be "frame pathName ?options?" at /usr/local/lib/perl5/site_perl/5.8.8/mach/Imager/Screenshot.pm line 72. It seems that $widget->can("frame") returns always a CODE reference on my system, but $widget->frame fails afterwards. This is with newest Perl/Tk from the SVN repository and with the older Tk 804.027, perl 5.8.8 on a FreeBSD 6.2 system. Regards, Slaven
On Thu Jan 31 16:47:31 2008, SREZIC wrote: Show quoted text
> I know that the "widget" option is not documented. Even so, here's a > report regarding this option. The following one-liner fails > > $ perl -MImager::Screenshot=screenshot -MTk -e '$l=tkinit->Label(-text > => "hello, world")->pack;$l->update;screenshot(widget => $l)' > wrong # args: should be "frame pathName ?options?" at > /usr/local/lib/perl5/site_perl/5.8.8/mach/Imager/Screenshot.pm line 72. > > It seems that $widget->can("frame") returns always a CODE reference on > my system, but $widget->frame fails afterwards. This is with newest > Perl/Tk from the SVN repository and with the older Tk 804.027, perl > 5.8.8 on a FreeBSD 6.2 system. >
I did some checks and it seems that a couple of widgets like Frame, Label, Button, Checkbutton etc. are also creatable using also the lower-cased name: perl -MTk -e '$mw=tkinit; $mw->label("hello"); $mw->children)[0]->pack;MainLoop' Very surprising to me, and I am using Perl/Tk since the beginning of the times... It's probably better to check if the widget is-a Tk::Wm. Regards, Slaven
On Thu Jan 31 16:47:31 2008, SREZIC wrote: Show quoted text
> I know that the "widget" option is not documented.
That's probably a bug in itself, I don't remember deliberately excluding it. (I've sent an email to create a ticket, but RT is slow tonight.) Show quoted text
> It seems that $widget->can("frame") returns always a CODE reference on > my system, but $widget->frame fails afterwards. This is with newest > Perl/Tk from the SVN repository and with the older Tk 804.027, perl > 5.8.8 on a FreeBSD 6.2 system.
The truth is I don't remember why that call to frame() is there, it was in my initial commit of the Tk widget code. I remember having a reason for it. For now in svn I've added a test that grabs a non-toplevel widget, which failed with the original code, and removed the frame() call, to get a passing test. Before release I'll test it on a few platforms to see if the removal causes any problems. If you want to play with the (trivial) modification, you can: svn co http://imager.perl.org/svn/trunk/Imager-Screenshot Tony
From: SREZIC [...] cpan.org
On Fri Feb 01 09:43:13 2008, TONYC wrote: Show quoted text
> On Thu Jan 31 16:47:31 2008, SREZIC wrote:
[...] Show quoted text
> > If you want to play with the (trivial) modification, you can: > > svn co http://imager.perl.org/svn/trunk/Imager-Screenshot >
Looks fine. Regards, Slaven
On Fri Feb 01 15:13:44 2008, SREZIC wrote: Show quoted text
> On Fri Feb 01 09:43:13 2008, TONYC wrote:
> > On Thu Jan 31 16:47:31 2008, SREZIC wrote:
> [...]
> > > > If you want to play with the (trivial) modification, you can: > > > > svn co http://imager.perl.org/svn/trunk/Imager-Screenshot > >
> > Looks fine.
This fix has been released in Imager::Screenshot 0.006 - just a few minute ago. Tony