You need to learn the difference between a window and a widget. Mainwindows do not have a background, you have to fill them with widgets that have the background capability, and according to your needs, the ability to place widgets on top. The only widget which easily does this is the canvas. As a matter of fact, I worked out a canvas based widget, with a background image at Tk::CanvasDirTree. A simple example is below. But there are glitches. You may not be able to acheive background transparency on your inserted widgets. A workaround would be to build your own custom canvas widgets out of geometric shapes, and use mouse bindings on them, to simulate the widget actions.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::JPEG;
use Tk::PNG;
my $file = shift || die "need a bmp, gif,jpg or png as arg 1\n";
my $mw=tkinit;
my $canvas = $mw->Scrolled('Canvas')->pack(-expand=>1, -fill=>'both');
my $img = $mw->Photo( -file => $file );
$canvas->createImage(0,0,
-image => $img,
-anchor => 'nw',
-tags => ['img'],
);
bunchOfBoxes();
sometext();
MainLoop;
sub bunchOfBoxes{
for(0..5){
my $window = $canvas->Checkbutton(-text=> $_);
$canvas->createWindow(10, 10+ $_ * 20,
-window=> $window);
}
}
sub sometext{
$canvas->createText(
50 , 50,
-text => 'foobar',
-anchor => 'center',
-fill => 'hotpink',
);
}
| [reply] [d/l] |
I'm not sure if either of these are directly applicable, but may help to point you in the right direction:
--chargrill
s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; =
qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
| [reply] [d/l] |
Thanks! I got it. The only remaining issue is that the labels are not transparent so they do not show the graphic underneath. From what I have read I would have to grab a slice of the underlying graphic to apply to each labe area and then render the characters on top of it. Since these are variable AND dynamic, it sounds too much like honest labour!
| [reply] |