Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: Re: Tk::Image problem

by holo (Monk)
on Nov 27, 2003 at 20:21 UTC ( [id://310593]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Tk::Image problem
in thread Tk::Image problem

To make up for my ignorance:

#!/usr/bin/perl use strict; use Tk; use Tk::Photo; my $main = new MainWindow; my $photo = $main->Photo(-format => 'gif', -file => 't.gif'); my $canvas = $main->Canvas( -width => $photo->width, -height => $photo->height, )->pack( -side => 'top' ); $canvas->createImage(0, 0, -image => $photo, -anchor => 'nw'); MainLoop;

Tk::Photo is not a widget, just an object that contains the photo. Use a Tk::Canvas to display the photo.

Replies are listed 'Best First'.
Re: Re: Re: Re: Tk::Image problem
by batkins (Chaplain) on Nov 27, 2003 at 22:34 UTC
    That works, but a Canvas is overkill:
    #!/usr/bin/perl use strict; use Tk; use Tk::Photo; my $main = new MainWindow; my $photo = $main->Photo(-format => 'gif', -file => 't.gif'); $main->Label(-image => $photo)->pack; MainLoop;
    Are you sure it was a book? Are you sure it wasn't.....nothing?
Re: Re: Re: Re: Tk::Image problem
by CombatSquirrel (Hermit) on Nov 27, 2003 at 21:11 UTC
    Thanks, that solved it ++
    CombatSquirrel.
    Entropy is the tendency of everything going to hell.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://310593]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-20 13:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found