Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Perl Tk GUI Design Question?

I'm looking for a way to use a bmp or gif as the background of a window. I can't quite figure how I would do that, but I assume it should be possible. Any help?

use Tk;

use strict;

my $mw = MainWindow->new;

$mw->geometry("400x100");

$mw->title("Main Window");

#$mw->Photo('imgbmp',-file=>"F:\\matrix.gif");

#$mw->Label('-image'=>'imgbmp')->pack;

my $info_frame1 = $mw->Frame()->pack(-side => "top");

my $message1;

$message1 = $info_frame1->Entry()->pack(-side => "right");

$message1->focus;

$info_frame1->Label(-text => "Enter Username:")->pack(-side => "right");

my $button1 = $mw->Button(-text => "Open chat window",

-command => \&button1_sub)->pack(-side => "top");

$button1->bind('Tk::Entry','<Return>', \&button1_sub);

$mw->bind('Tk::Entry','<Key-Escape>', sub{exit});

$mw->Button(-text => "Exit", -command => sub{exit})->pack();

my $message;

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    Sorry it's not directly possible. You could try packing the Photo into the Window and then using place() for all the other elements...

Still have questions? Get your answers by asking now.