in reply to Tk::JPEG
You can't attach a Photo to a MainWindow (Correction: Yes, you can, see Jouke's great example "below"). It needs to belong to a Label or a Button or a Text widget (and probably others).
my $mw = MainWindow->new; my $button = $mw->Button()->pack(); my $photo = $button->Photo( -format => 'jpeg', -file => 'test.jpg' ); $button->configure( -image => $photo ); MainLoop;
See also the perldoc for Tk::Photo, it's infinitely more useful than the docs for Tk::JPEG.
Update: now tested, added configure method, without which Tk never realizes it's supposed to be the -image for $button.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (ichimunki) Re: Tk::JPEG
by Amoe (Friar) on Aug 14, 2001 at 14:00 UTC | |
|
Re: (ichimunki) Re: Tk::JPEG
by Jouke (Curate) on Aug 16, 2001 at 12:20 UTC | |
by ichimunki (Priest) on Aug 16, 2001 at 16:40 UTC | |
by Jouke (Curate) on Aug 16, 2001 at 16:50 UTC | |
by ichimunki (Priest) on Aug 16, 2001 at 17:06 UTC | |
by padawan_linuxero (Scribe) on May 15, 2008 at 22:52 UTC |