comp.lang.perl.tk-image_in_background

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



From: cam@ntwk.net (Cameron)
Subject: Re: load image background in main window
Newsgroups: comp.lang.perl.tk
Date: 20 Sep 2003 06:46:18 -0700

slsbdfc@nus.edu.sg (Didier Casse) wrote:

> I'm trying to place a background in the Main Window as follows but it
> doesn't seem to work. Can anybody correct my syntax? Thanks a lot.
> 
> ------------------------------------------------------------------------------
>     $main -> Photo('bg', -file =>
> "/home/didier/backgrounds/blue.gif");
>     my $main = MainWindow->new(-image=>'bg');
> ------------------------------------------------------------------------------
The following works for me:

  # Background image for main screen
  $mainimage = $mw->Photo(-file=>"/images/image.gif");
  $mw -> Label(-image => $mainimage) -> pack(-expand => 1);

===

From: slsbdfc@nus.edu.sg (Didier Casse)
Subject: Re: load image background in main window
Newsgroups: comp.lang.perl.tk
Date: 20 Sep 2003 23:51:42 -0700

> The following works for me:
> 
>   # Background image for main screen
>   $mainimage = $mw->Photo(-file=>"/images/image.gif");
>   $mw -> Label(-image => $mainimage) -> pack(-expand => 1);

Thanks for the reply Cameron, but it your case, it gives the error
message,

"Can't call method Photo on an undefined value". However your reply
spurred the solution:

my $main = new MainWindow;
$main->Photo('bg','-file' => 'image.gif');
$main->Label(-image=>'bg')->pack;

now how can I create a button on this image, since it will load the
image but place any button underneath the image!

===

From: cam@ntwk.net (Cameron)
Subject: Re: load image background in main window
Newsgroups: comp.lang.perl.tk
Date: 23 Sep 2003 10:50:01 -0700

slsbdfc@nus.edu.sg (Didier Casse) wrote:

> > The following works for me:
> > 
> >   # Background image for main screen
> >   $mainimage = $mw->Photo(-file=>"/images/image.gif");
> >   $mw -> Label(-image => $mainimage) -> pack(-expand => 1);

> Thanks for the reply Cameron, but it your case, it gives the error
> message,
> 
> "Can't call method Photo on an undefined value". However your reply
> spurred the solution:
> 
> my $main = new MainWindow;
> $main->Photo('bg','-file' => 'image.gif');
> $main->Label(-image=>'bg')->pack;
> 
> now how can I create a button on this image, since it will load the
> image but place any button underneath the image!

   # Create a label widget for the main area.
   $blueframe = $mw->Frame(-bg => 'darkblue', -container => 0);
   $blueframe->pack(-fill => 'both', -side => 'top', -expand => 1);

   # Background image for main screen
   $mainimage = $blueframe->Photo(-file=>"/images/foo.gif");
   $blueframe -> Label(-image => $mainimage) -> pack(-expand => 1);

===

the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu