Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
The stupid question is the question not asked
 
PerlMonks  

Re: Tk::Image problem

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Tk::Image problem

Forgot to ->pack() your widget and main window!

Replies are listed 'Best First'.
Re: Re: Tk::Image problem
by CombatSquirrel (Hermit) on Nov 27, 2003 at 15:11 UTC
    I tried that too, but it gives me
    wrong # args: should be "pack option arg ?arg ...?" at t.pl line 9.
    when I use ->pack and
    bad option "image1": must be configure, forget, info, propagate, or sl +aves at t.pl line 9.
    when i use ->pack(-anchor => 'sw')
    Thanks for your response, anyways.
    CombatSquirrel.
    Entropy is the tendency of everything going to hell.

      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.

        Thanks, that solved it ++
        CombatSquirrel.
        Entropy is the tendency of everything going to hell.
        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: Tk::Image problem
by CombatSquirrel (Hermit) on Nov 27, 2003 at 15:11 UTC
    Oh, the question was, as you undoubtedly guessed, "How do I get it to work". Just posting it here, because I can't edit the root node any more.
    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://310588]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.